|
|
|
@ -36,15 +36,24 @@ module.exports = function(Categories) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
updatePostCount(tid, oldCid, cid);
|
|
|
|
updatePostCount(tid, oldCid, cid);
|
|
|
|
|
|
|
|
async.parallel({
|
|
|
|
topics.getPids(tid, function(err, pids) {
|
|
|
|
mainPid: function(next) {
|
|
|
|
|
|
|
|
topics.getTopicField(tid, 'mainPid', next);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
pids: function(next) {
|
|
|
|
|
|
|
|
topics.getPids(tid, next);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}, function(err, results) {
|
|
|
|
if (err) {
|
|
|
|
if (err) {
|
|
|
|
return winston.error(err.message);
|
|
|
|
return winston.error(err.message);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (pids && !pids.length) {
|
|
|
|
|
|
|
|
|
|
|
|
if (!results.mainPid && results.pids && !pids.length) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var pids = [results.mainPid].concat(results.pids);
|
|
|
|
|
|
|
|
|
|
|
|
var keys = pids.map(function(pid) {
|
|
|
|
var keys = pids.map(function(pid) {
|
|
|
|
return 'post:' + pid;
|
|
|
|
return 'post:' + pid;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|