From fa545c5bfd7c0cb76bfb6d664203b84b7a474518 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Thu, 28 Aug 2014 21:05:15 -0400 Subject: [PATCH 1/2] 0.5.0-4 Conflicts: package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 01592c9035..e97f1d1660 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "nodebb", "license": "GPLv3 or later", "description": "NodeBB Forum", - "version": "0.5.0-2", + "version": "0.5.0-4", "homepage": "http://www.nodebb.org", "repository": { "type": "git", From 5f2380fdcdb37b9256ee400b1633ac6dd393e4da Mon Sep 17 00:00:00 2001 From: barisusakli Date: Fri, 29 Aug 2014 14:08:13 -0400 Subject: [PATCH 2/2] dont display all categories --- src/categories.js | 4 ++-- src/controllers/index.js | 2 +- src/sitemap.js | 2 +- src/socket.io/categories.js | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) 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) {