if group search is executed with empty string, return all groups

This commit is contained in:
Julian Lam
2015-01-21 16:55:03 -05:00
parent 5fe69e0386
commit 2a6de59277
2 changed files with 4 additions and 4 deletions

View File

@@ -878,8 +878,8 @@ var async = require('async'),
};
Groups.search = function(query, options, callback) {
if (!query || !query.length) {
return callback(null, []);
if (!query) {
query = '';
}
async.waterfall([

View File

@@ -127,11 +127,11 @@ SocketGroups.delete = function(socket, data, callback) {
};
SocketGroups.search = function(socket, data, callback) {
if (!data || !data.query) {
if (!data) {
return callback(null, []);
}
groups.search(data.query, data.options || {}, callback);
groups.search(data.query || '', data.options || {}, callback);
};
SocketGroups.cover = {};