From 0bf98b549422b46fbaaf460154601bfaf3c36a97 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Thu, 22 Jan 2015 16:08:20 -0500 Subject: [PATCH] simplified isOwner check because there's no need to check admin status as admins automatically become owners now --- src/groups.js | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/groups.js b/src/groups.js index e7c1eed77b..7082ba5b65 100644 --- a/src/groups.js +++ b/src/groups.js @@ -884,22 +884,13 @@ var async = require('async'), Groups.updateCoverPosition(data.groupName, data.position, callback); }); - } + }; Groups.ownership = {}; Groups.ownership.isOwner = function(uid, groupName, callback) { - // Note: All admins are also owners - async.waterfall([ - async.apply(db.isSetMember, 'group:' + groupName + ':owners', uid), - function(isOwner, next) { - if (isOwner) { - return next(null, isOwner); - } - - user.isAdministrator(uid, next); - } - ], callback); + // Note: All admins automatically become owners upon joining + db.isSetMember('group:' + groupName + ':owners', uid, callback); }; Groups.ownership.grant = function(toUid, groupName, callback) {