mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-16 10:46:14 +01:00
if a parent category is deleted add its children to root
This commit is contained in:
@@ -65,7 +65,14 @@ module.exports = function(Categories) {
|
|||||||
},
|
},
|
||||||
function(next) {
|
function(next) {
|
||||||
async.each(results.children, function(cid, next) {
|
async.each(results.children, function(cid, next) {
|
||||||
|
async.parallel([
|
||||||
|
function(next) {
|
||||||
db.setObjectField('category:' + cid, 'parentCid', 0, next);
|
db.setObjectField('category:' + cid, 'parentCid', 0, next);
|
||||||
|
},
|
||||||
|
function(next) {
|
||||||
|
db.sortedSetAdd('cid:0:children', cid, cid, next);
|
||||||
|
}
|
||||||
|
], next);
|
||||||
}, next);
|
}, next);
|
||||||
}
|
}
|
||||||
], next);
|
], next);
|
||||||
|
|||||||
Reference in New Issue
Block a user