localSuggestionsController: skip accounts without a profile

This commit is contained in:
Alex Gleason 2025-01-30 21:56:45 -06:00
parent 2dfde337cd
commit b7a1efe33c
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7

View file

@ -113,14 +113,15 @@ export const localSuggestionsController: AppController = async (c) => {
) )
.then((events) => hydrateEvents({ store, events, signal })); .then((events) => hydrateEvents({ store, events, signal }));
const suggestions = await Promise.all([...pubkeys].map(async (pubkey) => { const suggestions = (await Promise.all([...pubkeys].map(async (pubkey) => {
const profile = profiles.find((event) => event.pubkey === pubkey); const profile = profiles.find((event) => event.pubkey === pubkey);
if (!profile) return;
return { return {
source: 'global', source: 'global',
account: profile ? await renderAccount(profile) : await accountFromPubkey(pubkey), account: await renderAccount(profile),
}; };
})); }))).filter(Boolean);
return paginated(c, grants, suggestions); return paginated(c, grants, suggestions);
}; };