Base defaultavatar text on displayname

Fix #4876
This commit is contained in:
kondou 2013-09-28 16:46:53 +02:00
parent cb565a5f60
commit 4907685405
3 changed files with 7 additions and 2 deletions

View File

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

View File

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

View File

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