Browse Source

Base defaultavatar text on displayname

Fix #4876
tags/v6.0.0alpha2
kondou 10 years ago
parent
commit
4907685405
3 changed files with 7 additions and 2 deletions
  1. 1
    1
      core/avatar/controller.php
  2. 5
    1
      core/js/jquery.avatar.js
  3. 1
    0
      settings/js/personal.js

+ 1
- 1
core/avatar/controller.php View File

@@ -33,7 +33,7 @@ class Controller {
$image->show();
} else {
// Signalizes $.avatar() to display a defaultavatar
\OC_JSON::success();
\OC_JSON::success(array("data"=> array("displayname"=> \OC_User::getDisplayName($user)) ));
}
}


+ 5
- 1
core/js/jquery.avatar.js View File

@@ -69,7 +69,11 @@
var url = OC.Router.generate('core_avatar_get', {user: user, size: size})+'?requesttoken='+oc_requesttoken;
$.get(url, function(result) {
if (typeof(result) === 'object') {
$div.placeholder(user);
if (result.data && result.data.displayname) {
$div.placeholder(user, result.data.displayname);
} else {
$div.placeholder(user);
}
} else {
if (ie8fix === true) {
$div.html('<img src="'+url+'#'+Math.floor(Math.random()*1000)+'">');

+ 1
- 0
settings/js/personal.js View File

@@ -34,6 +34,7 @@ function changeDisplayName(){
$('#oldDisplayName').text($('#displayName').val());
// update displayName on the top right expand button
$('#expandDisplayName').text($('#displayName').val());
updateAvatar();
}
else{
$('#newdisplayname').val(data.data.displayName);

Loading…
Cancel
Save