Merge pull request #1855 from owncloud/userlist_load_displaynames
Fetch displayname in userlist ajax requests. Refs #1681
This commit is contained in:
commit
78fce83405
2 changed files with 8 additions and 6 deletions
|
@ -29,10 +29,11 @@ if (isset($_GET['offset'])) {
|
|||
}
|
||||
$users = array();
|
||||
if (OC_User::isAdminUser(OC_User::getUser())) {
|
||||
$batch = OC_User::getUsers('', 10, $offset);
|
||||
foreach ($batch as $user) {
|
||||
$batch = OC_User::getDisplayNames('', 10, $offset);
|
||||
foreach ($batch as $user => $displayname) {
|
||||
$users[] = array(
|
||||
'name' => $user,
|
||||
'displayname' => $displayname,
|
||||
'groups' => join(', ', OC_Group::getUserGroups($user)),
|
||||
'subadmin' => join(', ', OC_SubAdmin::getSubAdminsGroups($user)),
|
||||
'quota' => OC_Preferences::getValue($user, 'files', 'quota', 'default'));
|
||||
|
@ -43,6 +44,7 @@ if (OC_User::isAdminUser(OC_User::getUser())) {
|
|||
foreach ($batch as $user) {
|
||||
$users[] = array(
|
||||
'name' => $user,
|
||||
'displayname' => OC_User::determineDisplayName($user),
|
||||
'groups' => join(', ', OC_Group::getUserGroups($user)),
|
||||
'quota' => OC_Preferences::getValue($user, 'files', 'quota', 'default'));
|
||||
}
|
||||
|
|
|
@ -66,10 +66,10 @@ var UserList = {
|
|||
}
|
||||
},
|
||||
|
||||
add: function (username, groups, subadmin, quota, sort) {
|
||||
add: function (username, displayname, groups, subadmin, quota, sort) {
|
||||
var tr = $('tbody tr').first().clone();
|
||||
tr.attr('data-uid', username);
|
||||
tr.attr('data-displayName', username);
|
||||
tr.attr('data-displayName', displayname);
|
||||
tr.find('td.name').text(username);
|
||||
tr.find('td.displayName').text(username);
|
||||
var groupsSelect = $('<select multiple="multiple" class="groupsselect" data-placehoder="Groups" title="' + t('settings', 'Groups') + '"></select>').attr('data-username', username).attr('data-user-groups', groups);
|
||||
|
@ -138,7 +138,7 @@ var UserList = {
|
|||
$.get(OC.Router.generate('settings_ajax_userlist', { offset: UserList.offset }), function (result) {
|
||||
if (result.status === 'success') {
|
||||
$.each(result.data, function (index, user) {
|
||||
var tr = UserList.add(user.name, user.groups, user.subadmin, user.quota, false);
|
||||
var tr = UserList.add(user.name, user.displayname, user.groups, user.subadmin, user.quota, false);
|
||||
UserList.offset++;
|
||||
if (index == 9) {
|
||||
$(tr).bind('inview', function (event, isInView, visiblePartX, visiblePartY) {
|
||||
|
@ -373,7 +373,7 @@ $(document).ready(function () {
|
|||
OC.dialogs.alert(result.data.message,
|
||||
t('settings', 'Error creating user'));
|
||||
} else {
|
||||
UserList.add(username, result.data.groups, null, 'default', true);
|
||||
UserList.add(username, username, result.data.groups, null, 'default', true);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue