Node.js based forum software built for the modern web
fix(topics): move queued post update before topic delete in merge
Julian Lam5847fb8d8104
diff --git a/src/topics/merge.js b/src/topics/merge.jsindex 7812a3d4e4..f3eb595f64 100644--- a/src/topics/merge.js+++ b/src/topics/merge.js@@ -23,6 +23,11 @@ module.exports = function (Topics) {const otherTids = tids.sort((a, b) => a - b).filter(tid => tid && String(tid) !== String(mergeIntoTid));+ await Promise.all([+ posts.updateQueuedPostsTopic(mergeIntoTid, otherTids),+ updateViewCount(mergeIntoTid, tids),+ ]);+for (const tid of otherTids) {/* eslint-disable no-await-in-loop */const pids = await Topics.getPids(tid);@@ -39,11 +44,6 @@ module.exports = function (Topics) {});}- await Promise.all([- posts.updateQueuedPostsTopic(mergeIntoTid, otherTids),- updateViewCount(mergeIntoTid, tids),- ]);-plugins.hooks.fire('action:topic.merge', {uid: uid,tids: tids,