From 4dd32e1024f35b4e9fed5bf55ab33a1b62542d26 Mon Sep 17 00:00:00 2001 From: psychobunny Date: Mon, 18 Aug 2014 13:05:13 -0400 Subject: [PATCH] filter:category.get applies to all category-like API calls now @a5mith https://gist.github.com/psychobunny/572d867935469774c6e8#comment-1281883 --- src/controllers/categories.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/controllers/categories.js b/src/controllers/categories.js index 506747f741..d11567c4de 100644 --- a/src/controllers/categories.js +++ b/src/controllers/categories.js @@ -8,7 +8,8 @@ var categoriesController = {}, user = require('./../user'), categories = require('./../categories'), topics = require('./../topics'), - meta = require('./../meta'); + meta = require('./../meta'), + plugins = require('./../plugins'); categoriesController.recent = function(req, res, next) { var uid = req.user ? req.user.uid : 0; @@ -19,7 +20,9 @@ categoriesController.recent = function(req, res, next) { data['feeds:disableRSS'] = meta.config['feeds:disableRSS'] === '1' ? true : false; - res.render('recent', data); + plugins.fireHook('filter:category.get', data, uid, function(err, data) { + res.render('recent', data); + }); }); }; @@ -35,7 +38,9 @@ categoriesController.popular = function(req, res, next) { data['feeds:disableRSS'] = meta.config['feeds:disableRSS'] === '1' ? true : false; - res.render('popular', {topics: data}); + plugins.fireHook('filter:category.get', {topics: data}, uid, function(err, data) { + res.render('popular', data); + }); }); }; @@ -47,7 +52,9 @@ categoriesController.unread = function(req, res, next) { return next(err); } - res.render('unread', data); + plugins.fireHook('filter:category.get', data, uid, function(err, data) { + res.render('unread', data); + }); }); };