From 0bec52bc19405fe0c6ef8cdcfd834518ac6b9b8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Mon, 20 Jun 2022 16:40:24 -0400 Subject: [PATCH] feat: closes #10719, don't trim children if category is marked section --- src/controllers/helpers.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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; + } }); } };