refactor: make getPubkeysBySearch() function use set of strings Set<string>

This commit is contained in:
P. Reis
2024-09-17 14:50:33 -03:00
parent 47c1d290b0
commit f73b20bf03
4 changed files with 8 additions and 14 deletions

View File

@@ -136,10 +136,7 @@ const accountSearchController: AppController = async (c) => {
return c.json(pubkey ? [await accountFromPubkey(pubkey)] : []);
}
const followList: string[] = [];
if (viewerPubkey) {
followList.push(...await getFollowedPubkeys(viewerPubkey));
}
const followList: Set<string> = viewerPubkey ? await getFollowedPubkeys(viewerPubkey) : new Set();
const pubkeys = (await getPubkeysBySearch(kysely, { q: query, limit, followList })).slice(0, limit);
let events = event ? [event] : await store.query([{ kinds: [0], authors: pubkeys, limit }], {

View File

@@ -96,10 +96,7 @@ async function searchEvents(
if (type === 'accounts') {
const kysely = await Storages.kysely();
const followList: string[] = [];
if (viewerPubkey) {
followList.push(...await getFollowedPubkeys(viewerPubkey));
}
const followList: Set<string> = viewerPubkey ? await getFollowedPubkeys(viewerPubkey) : new Set();
pubkeys.push(...(await getPubkeysBySearch(kysely, { q, limit, followList })));
if (!filter?.authors) {