refactor to use getCidsByPrivilege

switch to .includes
This commit is contained in:
Barış Soner Uşaklı
2018-07-20 14:34:42 -04:00
parent f1a6537fc2
commit 87b6808c4e
2 changed files with 13 additions and 13 deletions

View File

@@ -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);
},