user groups: Refactor settings_user_groups.can_edit.

This commit is contained in:
Shubham Dhama
2018-06-14 13:14:07 +05:30
committed by Tim Abbott
parent 281611f64c
commit 05323e776e
2 changed files with 11 additions and 12 deletions

View File

@@ -21,10 +21,12 @@ exports.reload = function () {
};
exports.can_edit = function (group_id) {
var me = people.get_person_from_user_id(people.my_current_user_id());
return user_groups.is_member_of(group_id, people.my_current_user_id()) || me.is_admin;
};
if (page_params.is_admin) {
return true;
}
return user_groups.is_member_of(group_id, people.my_current_user_id());
};
exports.populate_user_groups = function () {
var user_groups_section = $('#user-groups').expectOne();