mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-16 18:56:15 +01:00
closes #6912
- on category setParent dialog do not show children of current category - break recursion if category parentCid is equal to child cid to prevent infinite loop - dont allow setting the parentCid of a category to one of it's children
This commit is contained in:
@@ -92,6 +92,12 @@ module.exports = function (Categories) {
|
||||
}
|
||||
async.waterfall([
|
||||
function (next) {
|
||||
Categories.getChildrenCids(cid, next);
|
||||
},
|
||||
function (childrenCids, next) {
|
||||
if (childrenCids.includes(parseInt(newParent, 10))) {
|
||||
return next(new Error('[[error:cant-set-child-as-parent]]'));
|
||||
}
|
||||
Categories.getCategoryField(cid, 'parentCid', next);
|
||||
},
|
||||
function (oldParent, next) {
|
||||
|
||||
Reference in New Issue
Block a user