summaryrefslogtreecommitdiffstats
path: root/settings/js/users
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2016-08-24 10:03:07 +0200
committerArthur Schiwon <blizzz@arthur-schiwon.de>2016-08-29 13:34:28 +0200
commit17964a89553b15db6edef680fba42ef89a473d98 (patch)
treeafb8afa3ea073befac9595c227ee9f88bc0990d7 /settings/js/users
parente8c2d62c6bc008a963fe69cc868fc95027b72c6b (diff)
downloadnextcloud-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.js17
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);