mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-16 02:36:16 +01:00
closes #3447
recursively get all children calculate topic/post count from children new sorted set `cid:<id>:children` fix search query params
This commit is contained in:
@@ -30,15 +30,32 @@ module.exports = function(Categories) {
|
||||
function(next) {
|
||||
db.sortedSetRemove('categories:cid', cid, next);
|
||||
},
|
||||
function(next) {
|
||||
removeFromParent(cid, next);
|
||||
},
|
||||
function(next) {
|
||||
db.deleteAll([
|
||||
'cid:' + cid + ':tids',
|
||||
'cid:' + cid + ':tids:posts',
|
||||
'cid:' + cid + ':pids',
|
||||
'cid:' + cid + ':read_by_uid',
|
||||
'cid:' + cid + ':children',
|
||||
'category:' + cid
|
||||
], next);
|
||||
}
|
||||
], callback);
|
||||
}
|
||||
|
||||
function removeFromParent(cid, callback) {
|
||||
async.waterfall([
|
||||
function(next) {
|
||||
Categories.getCategoryField(cid, 'parentCid', next);
|
||||
},
|
||||
function(parentCid, next) {
|
||||
parentCid = parseInt(parentCid, 10) || 0;
|
||||
db.sortedSetRemove('cid:' + parentCid + ':children', cid, next);
|
||||
}
|
||||
], callback);
|
||||
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user