diff --git a/src/threadTools.js b/src/threadTools.js index 437cbec1b4..9e3bb2e53d 100644 --- a/src/threadTools.js +++ b/src/threadTools.js @@ -182,15 +182,19 @@ var async = require('async'), return callback(err); } var oldCid = topic.cid; - - if(!parseInt(topic.deleted, 10)) { - categories.incrementCategoryFieldBy(oldCid, 'topic_count', -1); - categories.incrementCategoryFieldBy(cid, 'topic_count', 1); - } - categories.moveRecentReplies(tid, oldCid, cid); - topics.setTopicField(tid, 'cid', cid, function(err) { + async.parallel([ + function (next) { + categories.incrementCategoryFieldBy(oldCid, 'topic_count', -1, next); + }, + function (next) { + categories.incrementCategoryFieldBy(cid, 'topic_count', 1, next); + }, + function (next) { + topics.setTopicField(tid, 'cid', cid, next); + } + ], function(err) { if (err) { return callback(err); }