From 40ebd66074f3730ec00f83bff36442a672d7bf22 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Wed, 13 Jan 2016 09:25:49 +0200 Subject: [PATCH] closes #4050 --- src/controllers/index.js | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/controllers/index.js b/src/controllers/index.js index 2f8f82350e..cc9fb14f2b 100644 --- a/src/controllers/index.js +++ b/src/controllers/index.js @@ -42,25 +42,25 @@ Controllers.home = function(req, res, next) { var hook = 'action:homepage.get:' + route; if (plugins.hasListeners(hook)) { - plugins.fireHook(hook, {req: req, res: res, next: next}); + return plugins.fireHook(hook, {req: req, res: res, next: next}); + } + + if (route === 'categories' || route === '/') { + Controllers.categories.list(req, res, next); + } else if (route === 'recent') { + Controllers.recent.get(req, res, next); + } else if (route === 'popular') { + Controllers.popular.get(req, res, next); } else { - if (route === 'categories' || route === '/') { - Controllers.categories.list(req, res, next); - } else if (route === 'recent') { - Controllers.recent.get(req, res, next); - } else if (route === 'popular') { - Controllers.popular.get(req, res, next); + var match = /^category\/(\d+)\/(.*)$/.exec(route); + + if (match) { + req.params.topic_index = "1"; + req.params.category_id = match[1]; + req.params.slug = match[2]; + Controllers.category.get(req, res, next); } else { - var match = /^category\/(\d+)\/(.*)$/.exec(route); - - if (match) { - req.params.topic_index = "1"; - req.params.category_id = match[1]; - req.params.slug = match[2]; - Controllers.categories.get(req, res, next); - } else { - res.redirect(route); - } + res.redirect(route); } } });