From 9ab38203dfa921c002715baed74386aaec061ddb Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Tue, 21 May 2024 14:37:18 -0500 Subject: [PATCH] getDescendants: filter out non-replies --- src/queries.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/queries.ts b/src/queries.ts index 6a197ea..7407077 100644 --- a/src/queries.ts +++ b/src/queries.ts @@ -88,7 +88,11 @@ async function getAncestors(event: NostrEvent, result: NostrEvent[] = []): Promi async function getDescendants(eventId: string, signal = AbortSignal.timeout(2000)): Promise { 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 }); }