Skip to content

Node.js based forum software built for the modern web

feat: closes #10719, don't trim children if category is marked section

Barış Soner Uşaklı0bec52bc1940
diff --git a/src/controllers/helpers.js b/src/controllers/helpers.js
index 7fd3449ca6..164dd5f0fa 100644
--- a/src/controllers/helpers.js
+++ b/src/controllers/helpers.js
@@ -357,10 +357,14 @@ helpers.getSelectedCategory = async function (cids) {
};
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.forEach((child) => {
- child.children = undefined;
+ if (category.isSection) {
+ helpers.trimChildren(child);
+ } else {
+ child.children = undefined;
+ }
});
}
};