mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-12 08:55:47 +01:00
error check
This commit is contained in:
@@ -141,21 +141,24 @@ var async = require('async'),
|
|||||||
};
|
};
|
||||||
|
|
||||||
Groups.search = function(query, options, callback) {
|
Groups.search = function(query, options, callback) {
|
||||||
if (query.length) {
|
if (!query) {
|
||||||
db.getSetMembers('groups', function(err, groups) {
|
return callback(null, []);
|
||||||
groups = groups.filter(function(groupName) {
|
|
||||||
return groupName.match(new RegExp(utils.escapeRegexChars(query), 'i'));
|
|
||||||
});
|
|
||||||
|
|
||||||
async.map(groups, function(groupName, next) {
|
|
||||||
Groups.get(groupName, options, next);
|
|
||||||
}, function(err, groups) {
|
|
||||||
callback(err, internals.filterGroups(groups, options));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
callback(null, []);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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'));
|
||||||
|
});
|
||||||
|
|
||||||
|
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) {
|
Groups.isMember = function(uid, groupName, callback) {
|
||||||
|
|||||||
Reference in New Issue
Block a user