mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-07 06:25:50 +01:00
refactor to use getCidsByPrivilege
switch to .includes
This commit is contained in:
@@ -95,7 +95,7 @@ Categories.getAllCategories = function (uid, callback) {
|
||||
], callback);
|
||||
};
|
||||
|
||||
Categories.getCategoriesByPrivilege = function (set, uid, privilege, callback) {
|
||||
Categories.getCidsByPrivilege = function (set, uid, privilege, callback) {
|
||||
async.waterfall([
|
||||
function (next) {
|
||||
db.getSortedSetRange(set, 0, -1, next);
|
||||
@@ -103,6 +103,14 @@ Categories.getCategoriesByPrivilege = function (set, uid, privilege, callback) {
|
||||
function (cids, next) {
|
||||
privileges.categories.filterCids(privilege, cids, uid, next);
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
Categories.getCategoriesByPrivilege = function (set, uid, privilege, callback) {
|
||||
async.waterfall([
|
||||
function (next) {
|
||||
Categories.getCidsByPrivilege(set, uid, privilege, next);
|
||||
},
|
||||
function (cids, next) {
|
||||
Categories.getCategories(cids, uid, next);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user