pipeline: fix admin event deletion

This commit is contained in:
Alex Gleason 2024-01-11 19:11:04 -06:00
parent c4920ccb2e
commit e3631104a6
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
1 changed files with 10 additions and 6 deletions

View File

@ -88,13 +88,17 @@ async function processDeletions(event: Event): Promise<void> {
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 }]);
}
}
}