mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-12 00:45:47 +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:
@@ -240,8 +240,13 @@ define('admin/manage/category', [
|
||||
}
|
||||
|
||||
Category.launchParentSelector = function () {
|
||||
var parents = [parseInt(ajaxify.data.category.cid, 10)];
|
||||
var categories = ajaxify.data.allCategories.filter(function (category) {
|
||||
return category && !category.disabled && parseInt(category.cid, 10) !== parseInt(ajaxify.data.category.cid, 10);
|
||||
var isChild = parents.includes(parseInt(category.parentCid, 10));
|
||||
if (isChild) {
|
||||
parents.push(parseInt(category.cid, 10));
|
||||
}
|
||||
return category && !category.disabled && parseInt(category.cid, 10) !== parseInt(ajaxify.data.category.cid, 10) && !isChild;
|
||||
});
|
||||
|
||||
categorySelector.modal(categories, function (parentCid) {
|
||||
|
||||
Reference in New Issue
Block a user