From ea29e3e250db3a79a04de443b38256cca45a1c29 Mon Sep 17 00:00:00 2001 From: Baris Usakli Date: Tue, 11 Jul 2017 15:53:30 -0400 Subject: [PATCH] simpler call to validateFilters --- src/controllers/mods.js | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/controllers/mods.js b/src/controllers/mods.js index 6ca2d1d7ac..fe68f81c55 100644 --- a/src/controllers/mods.js +++ b/src/controllers/mods.js @@ -20,18 +20,9 @@ modsController.flags.list = function (req, res, next) { async.parallel({ isAdminOrGlobalMod: async.apply(user.isAdminOrGlobalMod, req.uid), moderatedCids: async.apply(user.getModeratedCids, req.uid), + validFilters: async.apply(plugins.fireHook, 'filter:flags.validateFilters', { filters: validFilters }), }, next); }, - function (results, next) { - plugins.fireHook('filter:flags.validateFilters', { filters: validFilters }, function (err, data) { - if (err) { - return next(err); - } - - validFilters = data.filters; - next(null, results); - }); - }, function (results, next) { if (!(results.isAdminOrGlobalMod || !!results.moderatedCids.length)) { return next(new Error('[[error:no-privileges]]')); @@ -41,6 +32,8 @@ modsController.flags.list = function (req, res, next) { res.locals.cids = results.moderatedCids; } + validFilters = results.validFilters.filters; + // Parse query string params for filters hasFilter = false;