mirror of
https://github.com/aljazceru/ditto.git
synced 2026-01-19 05:14:27 +01:00
refactor: remove NIP-50 search if looking for accounts, use same filter
This commit is contained in:
@@ -91,21 +91,18 @@ async function searchEvents({ q, type, limit, account_id }: SearchQuery, signal:
|
||||
filter.authors = [account_id];
|
||||
}
|
||||
|
||||
const filter2: NostrFilter = {
|
||||
kinds: [0],
|
||||
limit,
|
||||
};
|
||||
if (type === 'accounts') {
|
||||
const kysely = await Storages.kysely();
|
||||
|
||||
const pubkeys = await getPubkeysBySearch(kysely, { q, limit });
|
||||
|
||||
filter2.authors = pubkeys; // if pubkeys is empty the filter 2 will be discarded
|
||||
filter.authors = pubkeys;
|
||||
filter.search = undefined;
|
||||
}
|
||||
|
||||
const store = await Storages.search();
|
||||
|
||||
return store.query([filter, filter2], { signal })
|
||||
return store.query([filter], { signal })
|
||||
.then((events) => hydrateEvents({ events, store, signal }));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user