I have a forum with 2 levels of categories. When logged in as an admin all categories and sub-categories are visible, but when browsing as an anonymous guest, the sub-categories cannot be seen. NodeBB is v0.9.2.
I've checked the permissions on the sub-categories and they are set as follows. I've also tried resetting and setting the permissions back but no difference:
I checked the code and the children are definitely being filtered out due to permissions. If I comment out the following lines of code in /src/categories.js the sub-categories show.
244 function (children, next) {
245 privileges.categories.filterCids('find', children, uid, next);
246 },
I added the following to the UI to see if the .children array is empty and it is - "We have children" never shows to guests:
<p><!-- IF ../children.length -->We have children<!-- ENDIF ../children.length --></p>
Here's my full UI code. Nothing inside the second <ul> renders:
<!-- IMPORT partials/breadcrumbs.tpl -->
<h1 class="categories-title">[[pages:categories]]</h1>
<ul class="home-category-list categories" itemscope itemtype="http://www.schema.org/ItemList">
<!-- BEGIN categories -->
<h2 class="title top-level-category">
<!-- IMPORT partials/categories/link.tpl --><br />
<div class="description">
{../descriptionParsed}
</div>
</h2>
<p><!-- IF ../children.length -->We have children<!-- ENDIF ../children.length --></p>
<ul class="home-sub-category-list categories" itemscope itemtype="http://www.schema.org/ItemList">
<!-- BEGIN children -->
<!-- IMPORT partials/categories/item.tpl -->
<!-- END children -->
</ul>
<div class="clearfix divider"></div>
<!-- END categories -->
</ul>