user js refactor, category fix

if a category that didn't exist was request with category/1231 or
api/category/1231 it was crashing.
This commit is contained in:
barisusakli
2014-03-12 20:53:42 -04:00
parent 67ef155c60
commit 90e398e5c9
12 changed files with 464 additions and 406 deletions

View File

@@ -89,6 +89,10 @@ categoriesController.get = function(req, res, next) {
end = start + settings.topicsPerPage - 1;
categories.getCategoryById(cid, start, end, uid, function (err, categoryData) {
if (err) {
return next(err);
}
if (categoryData) {
if (parseInt(categoryData.disabled, 10) === 1) {
return next(new Error('Category disabled'), null);