]> source.dussan.org Git - nextcloud-server.git/commitdiff
Base defaultavatar text on displayname
authorkondou <kondou@ts.unde.re>
Sat, 28 Sep 2013 14:46:53 +0000 (16:46 +0200)
committerkondou <kondou@ts.unde.re>
Sat, 28 Sep 2013 14:46:53 +0000 (16:46 +0200)
Fix #4876

core/avatar/controller.php
core/js/jquery.avatar.js
settings/js/personal.js

index 9f7c0517c4ad4b9de1e7acb825e6870f21f34c20..22693824461d70fe87d8c1c0ee13db9bbce0621e 100644 (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)) ));
                }
        }
 
index f1382fd7d2d61c7604ad65a4e710530263b92cbf..88a4c25d1eecfc401f7a684d6228a086eb8df44a 100644 (file)
                        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)+'">');
index eaaca32f5d8bad58881ae0b1d384d80748c30511..8944a7afa3cd027bf4dc9da1f899cd64085b2d4a 100644 (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);