mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-12 08:55:47 +01:00
simplified isOwner check because there's no need to check admin status as admins automatically become owners now
This commit is contained in:
@@ -884,22 +884,13 @@ var async = require('async'),
|
|||||||
|
|
||||||
Groups.updateCoverPosition(data.groupName, data.position, callback);
|
Groups.updateCoverPosition(data.groupName, data.position, callback);
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
Groups.ownership = {};
|
Groups.ownership = {};
|
||||||
|
|
||||||
Groups.ownership.isOwner = function(uid, groupName, callback) {
|
Groups.ownership.isOwner = function(uid, groupName, callback) {
|
||||||
// Note: All admins are also owners
|
// Note: All admins automatically become owners upon joining
|
||||||
async.waterfall([
|
db.isSetMember('group:' + groupName + ':owners', uid, callback);
|
||||||
async.apply(db.isSetMember, 'group:' + groupName + ':owners', uid),
|
|
||||||
function(isOwner, next) {
|
|
||||||
if (isOwner) {
|
|
||||||
return next(null, isOwner);
|
|
||||||
}
|
|
||||||
|
|
||||||
user.isAdministrator(uid, next);
|
|
||||||
}
|
|
||||||
], callback);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Groups.ownership.grant = function(toUid, groupName, callback) {
|
Groups.ownership.grant = function(toUid, groupName, callback) {
|
||||||
|
|||||||
Reference in New Issue
Block a user