Skip to content

Node.js based forum software built for the modern web

fix: Notes.delete to delete announcer zsets too

Julian Lamb5b89038ac1a
diff --git a/src/activitypub/notes.js b/src/activitypub/notes.js
index 8a405a05ee..9829ebc9d6 100644
--- a/src/activitypub/notes.js
+++ b/src/activitypub/notes.js
@@ -364,15 +364,11 @@ Notes.delete = async (pids) => {
pids = [pids];
}
- // Valid and remote content only
- pids = pids.filter(pid => !utils.isNumber(pid));
const exists = await posts.exists(pids);
pids = pids.filter((_, idx) => exists[idx]);
- let tids = await posts.getPostsFields(pids, ['tid']);
- tids = new Set(tids.map(obj => obj.tid));
-
const recipientSets = pids.map(id => `post:${id}:recipients`);
- await db.deleteAll(recipientSets);
- await Promise.all(Array.from(tids).map(async tid => Notes.syncUserInboxes(tid)));
+ const announcerSets = pids.map(id => `pid:${id}:announces`);
+
+ await db.deleteAll([...recipientSets, ...announcerSets]);
};