diff --git a/src/controllers/admin/categories.js b/src/controllers/admin/categories.js index 2ab344607e..73c8eb74db 100644 --- a/src/controllers/admin/categories.js +++ b/src/controllers/admin/categories.js @@ -15,7 +15,20 @@ categoriesController.get = function (req, res, callback) { async.parallel({ category: async.apply(categories.getCategories, [req.params.category_id], req.uid), parent: async.apply(categories.getParents, [req.params.category_id]), - allCategories: async.apply(categories.buildForSelect, req.uid, 'read'), + allCategories: function (next) { + async.waterfall([ + function (next) { + categories.getAllCidsFromSet('categories:cid', next); + }, + function (cids, next) { + categories.getCategories(cids, req.uid, next); + }, + function (categoryData, next) { + categoryData = categories.getTree(categoryData); + categories.buildForSelectCategories(categoryData, next); + }, + ], next); + }, }, next); }, function (data, next) {