v1.18.x
Barış Soner Uşaklı 10 years ago
parent 55262b399a
commit 094cd6df32

@ -123,25 +123,20 @@ define('forum/unread', ['forum/recent', 'topicSelect', 'forum/infinitescroll'],
} }
function createCategoryLinks(categories) { 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]); createCategoryLink(categories[i]);
} }
} }
function createCategoryLink(category) { function createCategoryLink(category) {
var link = $('<a role="menuitem" href="#"></a>'); var link = $('<a role="menuitem" href="#"></a>');
if (category.icon) { if (category.icon) {
link.append('<i class="fa fa-fw ' + category.icon + '"></i> ' + category.name); link.append('<i class="fa fa-fw ' + category.icon + '"></i> ' + category.name);
} else { } else {
link.append(category.name); link.append(category.name);
} }
$('<li role="presentation" class="category" data-cid="' + category.cid + '"></li>') $('<li role="presentation" class="category" data-cid="' + category.cid + '"></li>')
.append(link) .append(link)
.appendTo($('.markread .dropdown-menu')); .appendTo($('.markread .dropdown-menu'));

@ -121,12 +121,6 @@ var async = require('async'),
}, },
function(cids, next) { function(cids, next) {
Categories.getCategories(cids, uid, next); Categories.getCategories(cids, uid, next);
},
function(categories, next) {
categories = categories.filter(function(category) {
return !category.disabled;
});
next(null, categories);
} }
], callback); ], callback);
}; };
@ -286,10 +280,9 @@ var async = require('async'),
Categories.getCategoriesData(cids, next); Categories.getCategoriesData(cids, next);
}, },
function (categories, next) { function (categories, next) {
// Filter categories to isolate children, and remove disabled categories
async.map(cids, function(cid, next) { async.map(cids, function(cid, next) {
next(null, categories.filter(function(category) { 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); }, next);
} }

@ -84,6 +84,9 @@ module.exports = function(privileges) {
}); });
async.parallel({ async.parallel({
categories: function(next) {
categories.getMultipleCategoryFields(cids, ['disabled'], next);
},
allowedTo: function(next) { allowedTo: function(next) {
helpers.isUserAllowedTo(privilege, uid, cids, next); helpers.isUserAllowedTo(privilege, uid, cids, next);
}, },
@ -98,6 +101,10 @@ module.exports = function(privileges) {
return callback(err); return callback(err);
} }
cids = cids.filter(function(cid, index) {
return !results.categories[index].disabled;
});
if (results.isAdmin) { if (results.isAdmin) {
return callback(null, cids); return callback(null, cids);
} }

Loading…
Cancel
Save