fix topic_count on topic move

v1.18.x
barisusakli 10 years ago
parent 794c218cb6
commit d23d814154

@ -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);
}

Loading…
Cancel
Save