fix: get zap recipient in gatherAuthors() function

this is needed to work correctly in notifications
This commit is contained in:
P. Reis 2024-09-16 14:00:12 -03:00
parent af13614f1a
commit 9b66499df3

View file

@ -230,7 +230,13 @@ function gatherQuotes({ events, store, signal }: HydrateOpts): Promise<DittoEven
/** Collect authors from the events. */ /** Collect authors from the events. */
function gatherAuthors({ events, store, signal }: HydrateOpts): Promise<DittoEvent[]> { function gatherAuthors({ events, store, signal }: HydrateOpts): Promise<DittoEvent[]> {
const pubkeys = new Set(events.map((event) => event.pubkey)); const pubkeys = new Set(events.map((event) => {
if (event.kind === 9735) {
const pubkey = event.tags.find(([name]) => name === 'p')?.[1];
if (pubkey) return pubkey;
}
return event.pubkey;
}));
return store.query( return store.query(
[{ kinds: [0], authors: [...pubkeys], limit: pubkeys.size }], [{ kinds: [0], authors: [...pubkeys], limit: pubkeys.size }],