From ce2218bc93c78f6da62071f867e790032ab26b64 Mon Sep 17 00:00:00 2001 From: Martti Malmi Date: Sat, 3 Feb 2024 12:43:07 +0200 Subject: [PATCH] exclude your own events from ForYou --- packages/app/src/Db/getForYouFeed.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/app/src/Db/getForYouFeed.ts b/packages/app/src/Db/getForYouFeed.ts index fa70a4b0..0b90b77a 100644 --- a/packages/app/src/Db/getForYouFeed.ts +++ b/packages/app/src/Db/getForYouFeed.ts @@ -17,7 +17,7 @@ export async function getForYouFeed(pubkey: string): Promise { console.log("others who reacted", othersWhoReacted); // Get event ids reacted to by those others - const reactedByOthers = await getEventIdsReactedByOthers(othersWhoReacted, myReactedEvents); + const reactedByOthers = await getEventIdsReactedByOthers(othersWhoReacted, myReactedEvents, pubkey); console.log("reacted by others", reactedByOthers); // Get full events in sorted order @@ -68,7 +68,7 @@ async function getOthersWhoReacted(myReactedEventIds: Set, myPubkey: str return [...othersWhoReacted]; } -async function getEventIdsReactedByOthers(othersWhoReacted: string[], myReactedEvents: Set) { +async function getEventIdsReactedByOthers(othersWhoReacted: string[], myReactedEvents: Set, myPub: string) { const eventIdsReactedByOthers = new Map(); const events = await Relay.query([ @@ -81,7 +81,7 @@ async function getEventIdsReactedByOthers(othersWhoReacted: string[], myReactedE ]); events.forEach(event => { - if (myReactedEvents.has(event.id)) { + if (event.pubkey === myPub || myReactedEvents.has(event.id)) { // NIP-113 NOT filter could improve performance by not selecting these events in the first place return; }