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;