mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-12 00:45:47 +01:00
Merge remote-tracking branch 'refs/remotes/origin/master' into develop
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
var async = require('async');
|
||||
var validator = require('validator');
|
||||
var _ = require('lodash');
|
||||
|
||||
var db = require('./database');
|
||||
var posts = require('./posts');
|
||||
@@ -31,7 +31,6 @@ search.search = function (data, callback) {
|
||||
}
|
||||
},
|
||||
function (result, next) {
|
||||
result.search_query = validator.escape(String(data.query || ''));
|
||||
result.time = (process.elapsedTimeSince(start) / 1000).toFixed(2);
|
||||
next(null, result);
|
||||
},
|
||||
@@ -81,9 +80,7 @@ function searchInContent(data, callback) {
|
||||
function (mainPids, next) {
|
||||
pids = mainPids.concat(pids).map(function (pid) {
|
||||
return pid && pid.toString();
|
||||
}).filter(function (pid, index, array) {
|
||||
return pid && array.indexOf(pid) === index;
|
||||
});
|
||||
}).filter(Boolean);
|
||||
|
||||
privileges.posts.filter('read', pids, data.uid, next);
|
||||
},
|
||||
@@ -383,9 +380,8 @@ function getSearchCids(data, callback) {
|
||||
}, next);
|
||||
},
|
||||
function (results, next) {
|
||||
var cids = results.watchedCids.concat(results.childrenCids).concat(data.categories).filter(function (cid, index, array) {
|
||||
return cid && array.indexOf(cid) === index;
|
||||
});
|
||||
var cids = results.watchedCids.concat(results.childrenCids).concat(data.categories).filter(Boolean);
|
||||
cids = _.uniq(cids);
|
||||
next(null, cids);
|
||||
},
|
||||
], callback);
|
||||
|
||||
Reference in New Issue
Block a user