This commit is contained in:
Marshal
2026-07-22 11:04:17 +00:00
parent 996df4a7f8
commit 2aa405d8e4

View File

@@ -643,18 +643,6 @@ const filterSidebarByPermission = (
return true;
});
// Recursive: a group's own permission gates the whole subtree, leaves are
// checked individually, and a group with no surviving children disappears.
const filterItems = (items: SidebarItem[]): SidebarItem[] =>
items.flatMap((item) => {
if (item.children?.length) {
if (item.permission && !permissionAllowed(item)) return [];
const children = filterItems(item.children);
return children.length ? [{ ...item, children }] : [];
}
return itemAllowed(item) ? [item] : [];
});
return sections
.map((section) => ({
...section,