error check

v1.18.x
barisusakli 10 years ago
parent b89b960f86
commit a6e498bb5d

@ -141,21 +141,24 @@ var async = require('async'),
};
Groups.search = function(query, options, callback) {
if (query.length) {
db.getSetMembers('groups', function(err, groups) {
groups = groups.filter(function(groupName) {
return groupName.match(new RegExp(utils.escapeRegexChars(query), 'i'));
});
if (!query) {
return callback(null, []);
}
async.map(groups, function(groupName, next) {
Groups.get(groupName, options, next);
}, function(err, groups) {
callback(err, internals.filterGroups(groups, options));
});
db.getSetMembers('groups', function(err, groups) {
if (err) {
return callback(err);
}
groups = groups.filter(function(groupName) {
return groupName.match(new RegExp(utils.escapeRegexChars(query), 'i'));
});
} else {
callback(null, []);
}
async.map(groups, function(groupName, next) {
Groups.get(groupName, options, next);
}, function(err, groups) {
callback(err, internals.filterGroups(groups, options));
});
});
};
Groups.isMember = function(uid, groupName, callback) {

Loading…
Cancel
Save