DEV: nav-item should not fail when no top menu items exist

This can be called from themes where anonymous_top_menu_items is not set
cause the site requires login

Bail out cleanly if that is the case
This commit is contained in:
Sam Saffron 2019-12-04 10:30:04 +11:00
parent 2cca14d510
commit 57bb553499
1 changed files with 6 additions and 5 deletions

View File

@ -150,11 +150,12 @@ NavItem.reopenClass({
opts = opts || {};
if (
anonymous &&
!Site.currentProp("anonymous_top_menu_items").includes(filterType)
)
return null;
if (anonymous) {
const topMenuItems = Site.currentProp("anonymous_top_menu_items");
if (!topMenuItems || !topMenuItems.includes(filterType)) {
return null;
}
}
if (!Category.list() && filterType === "categories") return null;
if (!Site.currentProp("top_menu_items").includes(filterType)) return null;