Merge pull request #1701 from nextcloud/impr-user-list

tidy up adding user to list a little bit
This commit is contained in:
Lukas Reschke 2016-10-13 12:23:12 +02:00 committed by GitHub
commit f590bb1b3a
1 changed files with 4 additions and 17 deletions

View File

@ -48,10 +48,8 @@ var UserList = {
* 'email': 'username@example.org'
* 'isRestoreDisabled':false
* }
* @param sort
* @returns table row created for this user
*/
add: function (user, sort) {
add: function (user) {
if (this.currentGid && this.currentGid !== '_everyone' && _.indexOf(user.groups, this.currentGid) < 0) {
return;
}
@ -170,20 +168,12 @@ var UserList = {
UserList.checkUsersToLoad();
}
/**
* sort list
*/
if (sort) {
UserList.doSort();
}
$quotaSelect.on('change', UserList.onQuotaSelect);
// defer init so the user first sees the list appear more quickly
window.setTimeout(function(){
$quotaSelect.singleSelect();
}, 0);
return $tr;
},
// From http://my.opera.com/GreyWyvern/blog/show.dml/1671288
alphanum: function(a, b) {
@ -389,8 +379,6 @@ var UserList = {
OC.generateUrl('/settings/users/users'),
{ offset: UserList.offset, limit: limit, gid: gid, pattern: pattern },
function (result) {
var loadedUsers = 0;
var trs = [];
//The offset does not mirror the amount of users available,
//because it is backend-dependent. For correct retrieval,
//always the limit(requested amount of users) needs to be added.
@ -398,9 +386,7 @@ var UserList = {
if(UserList.has(user.name)) {
return true;
}
var $tr = UserList.add(user, false);
trs.push($tr);
loadedUsers++;
UserList.add(user);
});
if (result.length > 0) {
UserList.doSort();
@ -867,7 +853,8 @@ $(document).ready(function () {
}
}
if(!UserList.has(username)) {
UserList.add(result, true);
UserList.add(result);
UserList.doSort();
}
$('#newusername').focus();
GroupList.incEveryoneCount();