getDescendants: filter out non-replies

This commit is contained in:
Alex Gleason 2024-05-21 14:37:18 -05:00
parent d4625fe60d
commit 9ab38203df
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
1 changed files with 5 additions and 1 deletions

View File

@ -88,7 +88,11 @@ async function getAncestors(event: NostrEvent, result: NostrEvent[] = []): Promi
async function getDescendants(eventId: string, signal = AbortSignal.timeout(2000)): Promise<NostrEvent[]> {
const store = await Storages.db();
const events = await store.query([{ kinds: [1], '#e': [eventId] }], { limit: 200, signal });
const events = await store
.query([{ kinds: [1], '#e': [eventId] }], { limit: 200, signal })
.then((events) => events.filter(({ tags }) => findReplyTag(tags)?.[1] === eventId));
return hydrateEvents({ events, store, signal });
}