simpler call to validateFilters

v1.18.x
Baris Usakli 8 years ago
parent 50e37713bf
commit ea29e3e250

@ -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;

Loading…
Cancel
Save