Skip to content

Node.js based forum software built for the modern web

fire filter:serch.build if query is empty

Barış Soner Uşaklı2c86ca59e6c7
diff --git a/src/controllers/search.js b/src/controllers/search.js
index 93a7eccdc5..2020612094 100644
--- a/src/controllers/search.js
+++ b/src/controllers/search.js
@@ -24,7 +24,7 @@ searchController.search = function(req, res, next) {
}
if (!req.params.term) {
- return res.render('search', {
+ var results = {
time: 0,
search_query: '',
posts: [],
@@ -32,7 +32,14 @@ searchController.search = function(req, res, next) {
tags: [],
categories: categories,
breadcrumbs: breadcrumbs
+ };
+ plugins.fireHook('filter:search.build', {data: {}, results: results}, function(err, data) {
+ if (err) {
+ return next(err);
+ }
+ res.render('search', data.results);
});
+ return;
}
req.params.term = validator.escape(req.params.term);