mirror of
https://github.com/codeninjasllc/discourse.git
synced 2025-02-17 04:01:29 -05:00
TWEAK: If show_subcategory_list
is enabled, hide subcategories from
the site map.
This commit is contained in:
parent
b3c149de22
commit
7c0e723464
2 changed files with 9 additions and 9 deletions
|
@ -18,14 +18,14 @@ export default Ember.ArrayController.extend(Discourse.HasCurrentUser, {
|
|||
}.property(),
|
||||
|
||||
categories: function() {
|
||||
if (Discourse.SiteSettings.allow_uncategorized_topics) {
|
||||
return Discourse.Category.list();
|
||||
} else {
|
||||
// Exclude the uncategorized category if it's empty
|
||||
return Discourse.Category.list().reject(function(c) {
|
||||
return c.get('isUncategorizedCategory') && !Discourse.User.currentProp('staff');
|
||||
});
|
||||
}
|
||||
var hideUncategorized = !Discourse.SiteSettings.allow_uncategorized_topics,
|
||||
showSubcatList = Discourse.SiteSettings.show_subcategory_list,
|
||||
isStaff = Discourse.User.currentProp('staff');
|
||||
return Discourse.Category.list().reject(function(c) {
|
||||
if (showSubcatList && c.get('parent_category_id')) { return true; }
|
||||
if (hideUncategorized && c.get('isUncategorizedCategory') && !isStaff) { return true; }
|
||||
return false;
|
||||
});
|
||||
}.property(),
|
||||
|
||||
actions: {
|
||||
|
|
|
@ -72,7 +72,7 @@ test("categories", function() {
|
|||
var categoryListStub = ["category1", "category2"];
|
||||
this.stub(Discourse.Category, "list").returns(categoryListStub);
|
||||
|
||||
equal(controller.get("categories"), categoryListStub, "returns the list of categories");
|
||||
deepEqual(controller.get("categories"), categoryListStub, "returns the list of categories");
|
||||
});
|
||||
|
||||
test("toggleMobleView", function() {
|
||||
|
|
Loading…
Reference in a new issue