Skip to content

Node.js based forum software built for the modern web

cleaned up getCategories

Baris Usakli549017d035a8
diff --git a/src/categories.js b/src/categories.js
index 9833720896..95baee275e 100644
--- a/src/categories.js
+++ b/src/categories.js
@@ -335,8 +335,6 @@ var RDB = require('./redis.js'),
return;
}
- // var categories = [];
-
function getCategory(cid, callback) {
Categories.getCategoryData(cid, function(err, categoryData) {
if (err) {
@@ -348,7 +346,6 @@ var RDB = require('./redis.js'),
Categories.hasReadCategory(cid, current_user, function(hasRead) {
categoryData.badgeclass = (parseInt(categoryData.topic_count, 10) === 0 || (hasRead && current_user !== 0)) ? '' : 'badge-important';
- // categories.push(categoryData);
callback(null, categoryData);
});
});
@@ -362,11 +359,8 @@ var RDB = require('./redis.js'),
}
categories = categories.filter(function(category) {
- // Remove categories that have errored out
- if (category) return true;
- else return false;
+ return !!category;
}).sort(function(a, b) {
- // Sort categories into their defined order
return parseInt(a.order, 10) - parseInt(b.order, 10);
});