From 7a61645256421e8a21cadca19cbfd02ed5844082 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Tue, 9 Sep 2014 15:36:46 -0400 Subject: [PATCH] less db calls --- src/groups.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/groups.js b/src/groups.js index 3b5c6e8318..b4ee1b9c17 100644 --- a/src/groups.js +++ b/src/groups.js @@ -181,12 +181,12 @@ return callback(null, null); } - async.some(groupNames, function(groupName, next) { - Groups.isMember(uid, groupName, function(err, isMember) { - next(!err && isMember); - }); - }, function(result) { - callback(null, result); + Groups.isMemberOfGroups(uid, groupNames, function(err, isMembers) { + if (err) { + return callback(err); + } + + callback(null, isMembers.indexOf(true) !== -1) }); }); };