fixed issue where disabled categories showed up in the category dropdown in /unread
This commit is contained in:
Julian Lam
2015-07-23 12:47:58 -04:00
parent 12601dd3aa
commit 0bc175dd4c
2 changed files with 3 additions and 3 deletions

View File

@@ -156,7 +156,7 @@ var async = require('async'),
}
category.name = validator.escape(category.name);
category.disabled = parseInt(category.disabled, 10) === 1;
category.disabled = category.hasOwnProperty('disabled') ? parseInt(category.disabled, 10) === 1 : undefined;
category.icon = category.icon || 'hidden';
if (category.hasOwnProperty('post_count')) {
category.post_count = category.totalPostCount = category.post_count || 0;

View File

@@ -30,11 +30,11 @@ unreadController.unread = function(req, res, next) {
},
function(_results, next) {
results = _results;
categories.getMultipleCategoryFields(results.watchedCategories, ['cid', 'name', 'slug', 'icon', 'link'], next);
categories.getMultipleCategoryFields(results.watchedCategories, ['cid', 'name', 'slug', 'icon', 'link', 'disabled'], next);
},
function(categories, next) {
categories = categories.filter(function(category) {
return category && !category.link;
return category && !category.link && !category.disabled;
});
categories.forEach(function(category) {
category.selected = parseInt(category.cid, 10) === parseInt(cid, 10);