Skip to content

Node.js based forum software built for the modern web

closes #3742

barisusaklide4d747e633c
diff --git a/public/less/generics.less b/public/less/generics.less
index f9ef30469a..8104d2a35f 100644
--- a/public/less/generics.less
+++ b/public/less/generics.less
@@ -9,7 +9,7 @@
.border-radius(3px);
&.disabled {
- -webkit-filter: grayscale(30%);
+ background-color: #888!important;
.opacity(0.5);
}
}
diff --git a/public/src/admin/manage/category.js b/public/src/admin/manage/category.js
index 441afe29d6..0337064ad3 100644
--- a/public/src/admin/manage/category.js
+++ b/public/src/admin/manage/category.js
@@ -240,7 +240,7 @@ define('admin/manage/category', [
}
categories = categories.filter(function(category) {
- return category && parseInt(category.cid, 10) !== parseInt(ajaxify.data.category.cid, 10);
+ return category && !category.disabled && parseInt(category.cid, 10) !== parseInt(ajaxify.data.category.cid, 10);
});
templates.parse('partials/category_list', {
diff --git a/src/socket.io/categories.js b/src/socket.io/categories.js
index 4f6e5c14c0..d43d0c8171 100644
--- a/src/socket.io/categories.js
+++ b/src/socket.io/categories.js
@@ -15,7 +15,25 @@ SocketCategories.getRecentReplies = function(socket, cid, callback) {
};
SocketCategories.get = function(socket, data, callback) {
- categories.getCategoriesByPrivilege('categories:cid', socket.uid, 'find', callback);
+ async.parallel({
+ isAdmin: async.apply(user.isAdministrator, socket.uid),
+ categories: function(next) {
+ async.waterfall([
+ async.apply(db.getSortedSetRange, 'categories:cid', 0, -1),
+ async.apply(categories.getCategoriesData),
+ ], next);
+ }
+ }, function(err, results) {
+ if (err) {
+ return callback(err);
+ }
+
+ results.categories = results.categories.filter(function(category) {
+ return category && (!category.disabled || results.isAdmin);
+ });
+
+ callback(null, results.categories);
+ });
};
SocketCategories.getWatchedCategories = function(socket, data, callback) {