mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-05-06 10:06:31 +02:00
closes #2777
This commit is contained in:
@@ -123,25 +123,20 @@ define('forum/unread', ['forum/recent', 'topicSelect', 'forum/infinitescroll'],
|
||||
}
|
||||
|
||||
function createCategoryLinks(categories) {
|
||||
categories = categories.filter(function(category) {
|
||||
return !category.disabled;
|
||||
});
|
||||
|
||||
for(var i=0; i<categories.length; ++i) {
|
||||
for (var i=0; i<categories.length; ++i) {
|
||||
createCategoryLink(categories[i]);
|
||||
}
|
||||
}
|
||||
|
||||
function createCategoryLink(category) {
|
||||
|
||||
var link = $('<a role="menuitem" href="#"></a>');
|
||||
|
||||
if (category.icon) {
|
||||
link.append('<i class="fa fa-fw ' + category.icon + '"></i> ' + category.name);
|
||||
} else {
|
||||
link.append(category.name);
|
||||
}
|
||||
|
||||
|
||||
$('<li role="presentation" class="category" data-cid="' + category.cid + '"></li>')
|
||||
.append(link)
|
||||
.appendTo($('.markread .dropdown-menu'));
|
||||
|
||||
@@ -121,13 +121,7 @@ var async = require('async'),
|
||||
},
|
||||
function(cids, next) {
|
||||
Categories.getCategories(cids, uid, next);
|
||||
},
|
||||
function(categories, next) {
|
||||
categories = categories.filter(function(category) {
|
||||
return !category.disabled;
|
||||
});
|
||||
next(null, categories);
|
||||
}
|
||||
}
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -286,10 +280,9 @@ var async = require('async'),
|
||||
Categories.getCategoriesData(cids, next);
|
||||
},
|
||||
function (categories, next) {
|
||||
// Filter categories to isolate children, and remove disabled categories
|
||||
async.map(cids, function(cid, next) {
|
||||
next(null, categories.filter(function(category) {
|
||||
return category && parseInt(category.parentCid, 10) === parseInt(cid, 10) && !category.disabled;
|
||||
return category && parseInt(category.parentCid, 10) === parseInt(cid, 10);
|
||||
}));
|
||||
}, next);
|
||||
}
|
||||
|
||||
@@ -84,6 +84,9 @@ module.exports = function(privileges) {
|
||||
});
|
||||
|
||||
async.parallel({
|
||||
categories: function(next) {
|
||||
categories.getMultipleCategoryFields(cids, ['disabled'], next);
|
||||
},
|
||||
allowedTo: function(next) {
|
||||
helpers.isUserAllowedTo(privilege, uid, cids, next);
|
||||
},
|
||||
@@ -98,6 +101,10 @@ module.exports = function(privileges) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
cids = cids.filter(function(cid, index) {
|
||||
return !results.categories[index].disabled;
|
||||
});
|
||||
|
||||
if (results.isAdmin) {
|
||||
return callback(null, cids);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user