From ddcd37121fc88b43c4bd181625496663ae4fafe7 Mon Sep 17 00:00:00 2001 From: "John Molakvoæ (skjnldsv)" Date: Fri, 2 Mar 2018 16:35:17 +0100 Subject: Fix users loading on group click and group creation on select MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ (skjnldsv) --- settings/js/users/groups.js | 5 ++++- settings/js/users/users.js | 3 +-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/settings/js/users/groups.js b/settings/js/users/groups.js index fdad763f871..08bd26b230e 100644 --- a/settings/js/users/groups.js +++ b/settings/js/users/groups.js @@ -18,6 +18,9 @@ GroupList = { filterGroups: false, addGroup: function (gid, displayName, usercount) { + if (_.isUndefined(displayName)) { + displayName = gid; + } var $li = $userGroupList.find('.isgroup:last-child').clone(); $li .data('gid', gid) @@ -142,7 +145,7 @@ GroupList = { function (result) { if (result.groupname) { var addedGroup = result.groupname; - UserList.availableGroups[result.id] = {displayName: result.groupName}; + UserList.availableGroups[groupid] = {displayName: result.groupname}; GroupList.addGroup(groupid, result.groupname); } GroupList.toggleAddGroup(); diff --git a/settings/js/users/users.js b/settings/js/users/users.js index 2db43b24a0b..1a20edd19d1 100644 --- a/settings/js/users/users.js +++ b/settings/js/users/users.js @@ -66,7 +66,7 @@ var UserList = { * } */ add: function (user) { - if (this.currentGid && this.currentGid !== '_everyone' && this.currentGid !== '_disabledUsers' && _.indexOf(user.groups, this.currentGid) < 0) { + if (this.currentGid && this.currentGid !== '_everyone' && this.currentGid !== '_disabledUsers' && Object.keys(user.groups).indexOf(this.currentGid) < 0) { return false; } @@ -454,7 +454,6 @@ var UserList = { if (!OC.isUserAdmin() && checked.length === 1 && checked[0] === group) { return false; } - if (add && OC.isUserAdmin() && _.isUndefined(UserList.availableGroups[group])) { GroupList.createGroup(group); if (_.isUndefined(UserList.availableGroups[group])) { -- cgit v1.2.3