From 2996a5dc25dba27c2c48504aff91203ce6615c55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Tue, 12 Feb 2019 09:19:19 -0500 Subject: [PATCH] fix: #7359 --- src/controllers/admin/categories.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) 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) {