aboutsummaryrefslogtreecommitdiffstats
path: root/settings
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2013-03-29 07:19:09 -0700
committerBernhard Posselt <nukeawhale@gmail.com>2013-03-29 07:19:09 -0700
commit7c0999bd2736b65bbab3e0d7c16492aecbff908b (patch)
tree53555556a5e0180ff34f707fcfb06b16eeb2169a /settings
parentec980a8a25964ae9e7feec5ffc567502a091ddb0 (diff)
parent06a7d39024b2ad4057a997a4ef59d0cfc166d12c (diff)
downloadnextcloud-server-7c0999bd2736b65bbab3e0d7c16492aecbff908b.tar.gz
nextcloud-server-7c0999bd2736b65bbab3e0d7c16492aecbff908b.zip
Merge pull request #2448 from owncloud/userlist_available_groups
User list: Keep array of available groups. Should fix #873
Diffstat (limited to 'settings')
-rw-r--r--settings/js/users.js17
1 files changed, 13 insertions, 4 deletions
diff --git a/settings/js/users.js b/settings/js/users.js
index b0a70215f1c..d79b21765ff 100644
--- a/settings/js/users.js
+++ b/settings/js/users.js
@@ -6,6 +6,7 @@
var UserList = {
useUndo: true,
+ availableGroups: [],
/**
* @brief Initiate user deletion process in UI
@@ -78,8 +79,7 @@ var UserList = {
var subadminSelect = $('<select multiple="multiple" class="subadminsselect" data-placehoder="subadmins" title="' + t('settings', 'Group Admin') + '">').attr('data-username', username).attr('data-user-groups', groups).attr('data-subadmin', subadmin);
tr.find('td.subadmins').empty();
}
- var allGroups = String($('#content table').attr('data-groups')).split(', ');
- $.each(allGroups, function (i, group) {
+ $.each(this.availableGroups, function (i, group) {
groupsSelect.append($('<option value="' + escapeHTML(group) + '">' + escapeHTML(group) + '</option>'));
if (typeof subadminSelect !== 'undefined' && group != 'admin') {
subadminSelect.append($('<option value="' + escapeHTML(group) + '">' + escapeHTML(group) + '</option>'));
@@ -188,7 +188,6 @@ var UserList = {
});
}
});
- console.log('length', result.data.length);
if (result.data.length > 0) {
UserList.doSort();
}
@@ -218,7 +217,14 @@ var UserList = {
username: user,
group: group
},
- function () {
+ function (response) {
+ if(response.status === 'success' && response.data.action === 'add') {
+ if(UserList.availableGroups.indexOf(response.data.gropname) === -1) {
+ UserList.availableGroups.push(response.data.gropname);
+ }
+ } else {
+ OC.Notification.show(response.data.message);
+ }
}
);
};
@@ -289,6 +295,7 @@ var UserList = {
$(document).ready(function () {
UserList.doSort();
+ UserList.availableGroups = $('#content table').attr('data-groups').split(', ');
UserList.offset = $('tbody tr').length;
$('tbody tr:last').bind('inview', function (event, isInView, visiblePartX, visiblePartY) {
OC.Router.registerLoadedCallback(function () {
@@ -421,6 +428,8 @@ $(document).ready(function () {
OC.dialogs.alert(result.data.message,
t('settings', 'Error creating user'));
} else {
+ var addedGroups = result.data.groups.split(', ');
+ UserList.availableGroups = $.unique($.merge(UserList.availableGroups, addedGroups));
if($('tr[data-uid="' + username + '"]').length === 0) {
UserList.add(username, username, result.data.groups, null, 'default', true);
}