mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-02-01 03:12:42 +01:00
Merge pull request #1882 from fviard/develop
Fix to check if searchTerm is not "undefined" before trying to use it to...
This commit is contained in:
commit
8073c62de3
1 changed files with 4 additions and 2 deletions
|
@ -79,10 +79,12 @@ exports.search = function(searchTerm, maxCacheAge, cb) {
|
||||||
exports.getAvailablePlugins(maxCacheAge, function(er, results) {
|
exports.getAvailablePlugins(maxCacheAge, function(er, results) {
|
||||||
if(er) return cb && cb(er);
|
if(er) return cb && cb(er);
|
||||||
var res = {};
|
var res = {};
|
||||||
searchTerm = searchTerm.toLowerCase();
|
if (searchTerm)
|
||||||
|
searchTerm = searchTerm.toLowerCase();
|
||||||
for (var pluginName in results) { // for every available plugin
|
for (var pluginName in results) { // for every available plugin
|
||||||
if (pluginName.indexOf(plugins.prefix) != 0) continue; // TODO: Also search in keywords here!
|
if (pluginName.indexOf(plugins.prefix) != 0) continue; // TODO: Also search in keywords here!
|
||||||
if(pluginName.indexOf(searchTerm) < 0 && results[pluginName].description.indexOf(searchTerm) < 0) continue;
|
|
||||||
|
if(searchTerm && pluginName.indexOf(searchTerm) < 0 && results[pluginName].description.indexOf(searchTerm) < 0) continue;
|
||||||
res[pluginName] = results[pluginName];
|
res[pluginName] = results[pluginName];
|
||||||
}
|
}
|
||||||
cb && cb(null, res)
|
cb && cb(null, res)
|
||||||
|
|
Loading…
Reference in a new issue