diff options
author | Vincent Petry <pvince81@owncloud.com> | 2016-08-24 10:03:07 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2016-08-29 13:34:28 +0200 |
commit | 17964a89553b15db6edef680fba42ef89a473d98 (patch) | |
tree | afb8afa3ea073befac9595c227ee9f88bc0990d7 /settings/js/users | |
parent | e8c2d62c6bc008a963fe69cc868fc95027b72c6b (diff) | |
download | nextcloud-server-17964a89553b15db6edef680fba42ef89a473d98.tar.gz nextcloud-server-17964a89553b15db6edef680fba42ef89a473d98.zip |
Extra non-available groups also in list
Diffstat (limited to 'settings/js/users')
-rw-r--r-- | settings/js/users/users.js | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/settings/js/users/users.js b/settings/js/users/users.js index 7922cd9c656..f24bf82209b 100644 --- a/settings/js/users/users.js +++ b/settings/js/users/users.js @@ -565,6 +565,7 @@ var UserList = { var placeholder = $groupsListContainer.attr('data-placeholder') || t('settings', 'no group'); var user = UserList.getUID($td); var checked = $td.data('groups') || []; + var extraGroups = [].concat(checked); $td.find('.multiselectoptions').remove(); @@ -576,12 +577,25 @@ var UserList = { $groupsSelect = $('<select multiple="multiple" class="subadminsselect multiselect button" title="' + placeholder + '"></select>') } - $.each(this.availableGroups, function (i, group) { + function createItem(group) { if (isSubadminSelect && group === 'admin') { // can't become subadmin of "admin" group return; } $groupsSelect.append($('<option value="' + escapeHTML(group) + '">' + escapeHTML(group) + '</option>')); + } + + $.each(this.availableGroups, function (i, group) { + // some new groups might be selected but not in the available groups list yet + var extraIndex = extraGroups.indexOf(group); + if (extraIndex >= 0) { + // remove extra group as it was found + extraGroups.splice(extraIndex, 1); + } + createItem(group); + }); + $.each(extraGroups, function (i, group) { + createItem(group); }); $td.append($groupsSelect); @@ -779,7 +793,6 @@ $(document).ready(function () { }); $('#newuser .groupsListContainer').on('click', function (event) { - var $target = $(event.target); event.stopPropagation(); var $div = $(this).closest('.groups'); UserList._triggerGroupEdit($div); |