Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tidy up adding user to list a little bit #1701

Merged
merged 1 commit into from
Oct 13, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 4 additions & 17 deletions settings/js/users/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -389,18 +379,14 @@ 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.
$.each(result, function (index, user) {
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();
Expand Down Expand Up @@ -867,7 +853,8 @@ $(document).ready(function () {
}
}
if(!UserList.has(username)) {
UserList.add(result, true);
UserList.add(result);
UserList.doSort();
}
$('#newusername').focus();
GroupList.incEveryoneCount();
Expand Down