only display readable categories in /unread dropdown

v1.18.x
barisusakli 10 years ago
parent d5128d0513
commit 0dfe2e0e90

@ -5,6 +5,7 @@ var async = require('async'),
meta = require('../meta'),
categories = require('../categories'),
privileges = require('../privileges'),
user = require('../user'),
topics = require('../topics'),
helpers = require('./helpers');
@ -30,11 +31,15 @@ unreadController.unread = function(req, res, next) {
},
function(_results, next) {
results = _results;
categories.getMultipleCategoryFields(results.watchedCategories, ['cid', 'name', 'slug', 'icon', 'link', 'disabled'], next);
privileges.categories.filterCids('read', results.watchedCategories, req.uid, next);
},
function(cids, next) {
categories.getMultipleCategoryFields(cids, ['cid', 'name', 'slug', 'icon', 'link'], next);
},
function(categories, next) {
categories = categories.filter(function(category) {
return category && !category.link && !category.disabled;
return category && !category.link;
});
categories.forEach(function(category) {
category.selected = parseInt(category.cid, 10) === parseInt(cid, 10);

Loading…
Cancel
Save