From a63c67993579ffec60a89cce61010c0457e77cc9 Mon Sep 17 00:00:00 2001 From: acardinale Date: Sun, 8 Feb 2015 11:58:01 +0100 Subject: [PATCH 1/4] Add hook "filter:topic.build" Same behavior as "filter:register.build" --- src/controllers/topics.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/controllers/topics.js b/src/controllers/topics.js index 498a3d81db..4c7708c2ba 100644 --- a/src/controllers/topics.js +++ b/src/controllers/topics.js @@ -266,7 +266,14 @@ topicsController.get = function(req, res, next) { }); topics.increaseViewCount(tid); - res.render('topic', data); + + plugins.fireHook('filter:topic.build', {req: req, res: res, templateData: data}, function(err, data) { + if (err && process.env === 'development') { + winston.warn(JSON.stringify(err)); + return next(err); + } + res.render('topic', data.templateData); + }); }); }; From 612acc41ba310d78d74c38daeef03adc32886988 Mon Sep 17 00:00:00 2001 From: acardinale Date: Sun, 8 Feb 2015 12:05:26 +0100 Subject: [PATCH 2/4] Add hook "filter:category.build" Same behavior as "filter:register.build" --- src/controllers/categories.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/controllers/categories.js b/src/controllers/categories.js index 25690a6810..7ea49453f5 100644 --- a/src/controllers/categories.js +++ b/src/controllers/categories.js @@ -266,7 +266,13 @@ categoriesController.get = function(req, res, next) { res.locals.linkTags.push(rel); }); - res.render('category', data); + plugins.fireHook('filter:category.build', {req: req, res: res, templateData: data}, function(err, data) { + if (err && process.env === 'development') { + winston.warn(JSON.stringify(err)); + return next(err); + } + res.render('category', data.templateData); + }); }); }; From 8975a0962ea9a229004f52769dc7ce8380c33e44 Mon Sep 17 00:00:00 2001 From: acardinale Date: Wed, 18 Feb 2015 15:26:05 +0100 Subject: [PATCH 3/4] Update topics.js --- src/controllers/topics.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/controllers/topics.js b/src/controllers/topics.js index 4c7708c2ba..1d756b4189 100644 --- a/src/controllers/topics.js +++ b/src/controllers/topics.js @@ -268,8 +268,7 @@ topicsController.get = function(req, res, next) { topics.increaseViewCount(tid); plugins.fireHook('filter:topic.build', {req: req, res: res, templateData: data}, function(err, data) { - if (err && process.env === 'development') { - winston.warn(JSON.stringify(err)); + if (err) { return next(err); } res.render('topic', data.templateData); From 6607dfc4c9947a4201813f8e71520b79b322e2ad Mon Sep 17 00:00:00 2001 From: acardinale Date: Wed, 18 Feb 2015 15:27:14 +0100 Subject: [PATCH 4/4] Update categories.js --- src/controllers/categories.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/controllers/categories.js b/src/controllers/categories.js index 7ea49453f5..64c5d8c61a 100644 --- a/src/controllers/categories.js +++ b/src/controllers/categories.js @@ -267,8 +267,7 @@ categoriesController.get = function(req, res, next) { }); plugins.fireHook('filter:category.build', {req: req, res: res, templateData: data}, function(err, data) { - if (err && process.env === 'development') { - winston.warn(JSON.stringify(err)); + if (err) { return next(err); } res.render('category', data.templateData);