aboutsummaryrefslogtreecommitdiffstats
path: root/src/features
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-11-17 13:14:03 -0700
committerAdam Soltys <[email protected]>2026-11-17 13:14:03 -0700
commit7b2c4626ae67f9d337d285bdd9170f511a9c14aa (patch)
tree7f8cf107c23d63b01b49f8f76629bb2307d224b4 /src/features
parent550776ed795f1da392ea39a7de5850630f02b16f (diff)
downloadcoinosv3-7b2c4626ae67f9d337d285bdd9170f511a9c14aa.tar.gz
coinosv3-7b2c4626ae67f9d337d285bdd9170f511a9c14aa.zip
People search looks among the people you follow first. "derek ross leaked his key and started a new npub. i tried searching him up and found this … it says no posts" … "Did we get our search to bring up his new account … as the top result?" (Adam, 2026-11-17). Search for "derek ross" came up with an empty impostor key: Primal's user search (our main source) doesn't index his new key yet and ranks by its own trust score, and only one NIP-50 relay has it, 34th. Adam already follows the new key. Now a follow whose name or NIP-05 matches the query ranks with coinos usernames, above the indexes; the chat feature hands its follow list and the profiles it holds to the search, and fetches follows' profiles it has never seen once a session, the first time a search asks. Rows found while those are still loading aren't cached, so the next search sees them; older cached results are dropped (search cache v3). New search-follows-test (follow first, impostor still listed after, renamed old key not matched, NIP-05 match, partial answers not cached) passes, with search-scope, search-avatar-loading and features-smoke.
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VMan6SwkivduFDDkMmnXjZ
Diffstat (limited to 'src/features')
-rw-r--r--src/features/messages.js26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/features/messages.js b/src/features/messages.js
index d5d286a..95fcde8 100644
--- a/src/features/messages.js
+++ b/src/features/messages.js
@@ -39,7 +39,7 @@ import { createThreadPrefetch } from '../thread-prefetch.js';
import { makeImageThumbnails } from '../image-thumbnails.js';
import { createFeedCache, FEED_CACHE_POSTS, FEED_SEED_POSTS } from '../feed-cache.js';
import { POPULAR_RELAYS, FIREHOSE_RELAYS, popularCandidates } from '../popular-feed.js';
-import { makeSearcher, resultRows, fallbackAvatar, warmSearch, punkImageUrl, punkSmallUrl, primalCache, searchRecipients, searchable } from '../recipient-search.js';
+import { makeSearcher, resultRows, fallbackAvatar, warmSearch, punkImageUrl, punkSmallUrl, primalCache, searchRecipients, searchable, setLocalPeople } from '../recipient-search.js';
import { getNetwork } from '../api.js';
import { decodeBolt11 } from '../ark/lightning.js';
import { hexToBytes, bytesToHex } from '@noble/hashes/utils';
@@ -17186,6 +17186,30 @@ export function messagesFeature(ctx) {
e.id && !e.isNew ? h('button', { class: 'btn-ghost btn-block', onClick: () => deleteFeed(e.id) }, t('feedDelete')) : null);
}
+ // People search looks among your follows first (recipient-search.js). Their
+ // names come from the profiles this device holds; the ones it has never
+ // seen are fetched once a session, the first time a search asks.
+ let followFacesAsked = false, followFacesPending = false;
+ setLocalPeople(() => {
+ const set = follows && follows.set;
+ if (!set || !set.size) return [];
+ if (!followFacesAsked) {
+ followFacesAsked = true;
+ const missing = [...set].filter((pk) => !profiles.get(pk)?.name && !profInFlight.has(pk));
+ if (missing.length) {
+ followFacesPending = true;
+ fetchProfiles(missing.slice(0, 2000)).catch(() => {}).finally(() => { followFacesPending = false; });
+ }
+ }
+ const out = [];
+ out.partial = followFacesPending;
+ for (const pk of set) {
+ const p = profiles.get(pk);
+ if (p && (p.name || p.nip05)) out.push({ pk, name: p.name, nip05: p.nip05, picture: p.picture });
+ }
+ return out;
+ });
+
// ---- user search: the header magnifier ----------------------------------
// Same engine the Send form and DMs use (registrar names + Primal cache +
// NIP-50 relays); tapping a result opens their profile, and profile-Back