mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-05-07 08:37:05 +02:00
fix: topic crosspost delete and purge handling
This commit is contained in:
@@ -127,4 +127,14 @@ Crossposts.remove = async function (tid, cid, uid) {
|
||||
|
||||
crossposts = await Crossposts.get(tid);
|
||||
return crossposts;
|
||||
};
|
||||
|
||||
Crossposts.removeAll = async function (tid) {
|
||||
const crosspostIds = await db.getSortedSetMembers(`tid:${tid}:crossposts`);
|
||||
const crossposts = await db.getObjects(crosspostIds.map(id => `crosspost:${id}`));
|
||||
await Promise.all(crossposts.map(async ({ tid, cid, uid }) => {
|
||||
return Crossposts.remove(tid, cid, uid);
|
||||
}));
|
||||
|
||||
return [];
|
||||
};
|
||||
@@ -102,6 +102,7 @@ module.exports = function (Topics) {
|
||||
Topics.deleteTopicTags(tid),
|
||||
Topics.events.purge(tid),
|
||||
Topics.thumbs.deleteAll(tid),
|
||||
Topics.crossposts.removeAll(tid),
|
||||
reduceCounters(tid),
|
||||
]);
|
||||
plugins.hooks.fire('action:topic.purge', { topic: deletedTopic, uid: uid });
|
||||
|
||||
Reference in New Issue
Block a user