From 8069cbda6980d3e1565323e226ec7059873c9c43 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Thu, 9 Apr 2015 18:15:31 -0400 Subject: [PATCH] closes #2979 if all is selected search in all categories --- src/search.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/search.js b/src/search.js index 063ebfa142..7d76666f7e 100644 --- a/src/search.js +++ b/src/search.js @@ -363,10 +363,22 @@ function sortPosts(posts, data) { } function getSearchCids(data, callback) { - if (!Array.isArray(data.categories) || !data.categories.length || data.categories.indexOf('all') !== -1) { + if (!Array.isArray(data.categories) || !data.categories.length) { return callback(null, []); } + if (data.categories.indexOf('all') !== -1) { + async.waterfall([ + function(next) { + db.getSortedSetRange('categories:cid', 0, -1, next); + }, + function(cids, next) { + privileges.categories.filterCids('read', cids, data.uid, next); + } + ], callback); + return; + } + async.parallel({ watchedCids: function(next) { if (data.categories.indexOf('watched') !== -1) {