mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
feat: closes #10719, don't trim children if category is marked section
This commit is contained in:
committed by
Julian Lam
parent
15fb6c3304
commit
7e80cc1033
@@ -357,10 +357,14 @@ helpers.getSelectedCategory = async function (cids) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
helpers.trimChildren = function (category) {
|
helpers.trimChildren = function (category) {
|
||||||
if (Array.isArray(category.children)) {
|
if (category && Array.isArray(category.children)) {
|
||||||
category.children = category.children.slice(0, category.subCategoriesPerPage);
|
category.children = category.children.slice(0, category.subCategoriesPerPage);
|
||||||
category.children.forEach((child) => {
|
category.children.forEach((child) => {
|
||||||
child.children = undefined;
|
if (category.isSection) {
|
||||||
|
helpers.trimChildren(child);
|
||||||
|
} else {
|
||||||
|
child.children = undefined;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user