Skip to content

Node.js based forum software built for the modern web

dont display all categories

barisusakli5f2380fdcdb3
diff --git a/src/categories.js b/src/categories.js
index bf42392596..eae19b4595 100644
--- a/src/categories.js
+++ b/src/categories.js
@@ -188,7 +188,7 @@ var db = require('./database'),
});
};
- Categories.getVisibleCategories = function(uid, callback) {
+ Categories.getCategoriesByPrivilege = function(uid, privilege, callback) {
db.getSortedSetRange('categories:cid', 0, -1, function(err, cids) {
if (err) {
return callback(err);
@@ -198,7 +198,7 @@ var db = require('./database'),
return callback(null, []);
}
- privileges.categories.filter('find', cids, uid, function(err, cids) {
+ privileges.categories.filter(privilege, cids, uid, function(err, cids) {
if (err) {
return callback(err);
}
diff --git a/src/controllers/index.js b/src/controllers/index.js
index ccea529f5b..96748917b6 100644
--- a/src/controllers/index.js
+++ b/src/controllers/index.js
@@ -64,7 +64,7 @@ Controllers.home = function(req, res, next) {
},
categories: function (next) {
var uid = req.user ? req.user.uid : 0;
- categories.getVisibleCategories(uid, function (err, categoryData) {
+ categories.getCategoriesByPrivilege(uid, 'find', function (err, categoryData) {
if (err) {
return next(err);
}
diff --git a/src/sitemap.js b/src/sitemap.js
index e01a2cde3e..5db793a128 100644
--- a/src/sitemap.js
+++ b/src/sitemap.js
@@ -31,7 +31,7 @@ var path = require('path'),
async.parallel([
function(next) {
var categoryUrls = [];
- categories.getVisibleCategories(0, function(err, categoriesData) {
+ categories.getCategoriesByPrivilege(0, 'find', function(err, categoriesData) {
if (err) {
return next(err);
}
diff --git a/src/socket.io/categories.js b/src/socket.io/categories.js
index c594361589..bbe578d870 100644
--- a/src/socket.io/categories.js
+++ b/src/socket.io/categories.js
@@ -24,7 +24,7 @@ SocketCategories.getRecentReplies = function(socket, cid, callback) {
};
SocketCategories.get = function(socket, data, callback) {
- categories.getAllCategories(callback);
+ categories.getCategoriesByPrivilege(socket.uid, 'find', callback);
};
SocketCategories.loadMore = function(socket, data, callback) {