From e3631104a6010bba9ac57e138158317166eccf19 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Thu, 11 Jan 2024 19:11:04 -0600 Subject: [PATCH] pipeline: fix admin event deletion --- src/pipeline.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/pipeline.ts b/src/pipeline.ts index 2ffc6b9..3333bec 100644 --- a/src/pipeline.ts +++ b/src/pipeline.ts @@ -88,13 +88,17 @@ async function processDeletions(event: Event): Promise { if (event.kind === 5) { const ids = getTagSet(event.tags, 'e'); - const events = await eventsDB.filter([{ - ids: [...ids], - authors: [Conf.pubkey, event.pubkey], - }]); + if (event.pubkey === Conf.pubkey) { + await eventsDB.deleteFilters([{ ids: [...ids] }]); + } else { + const events = await eventsDB.filter([{ + ids: [...ids], + authors: [event.pubkey], + }]); - const deleteIds = events.map(({ id }) => id); - await eventsDB.deleteFilters([{ ids: deleteIds }]); + const deleteIds = events.map(({ id }) => id); + await eventsDB.deleteFilters([{ ids: deleteIds }]); + } } }