diff options
author | kondou <kondou@ts.unde.re> | 2014-02-20 21:53:59 +0100 |
---|---|---|
committer | kondou <kondou@ts.unde.re> | 2014-02-20 21:53:59 +0100 |
commit | 0e0b4d55756e438111264423cc04baadb8b067a7 (patch) | |
tree | 160937fa225187991367773b23778629a0003ee6 /settings/js/personal.js | |
parent | 917a505af4c2182e585513e5188da17ac00b0cf1 (diff) | |
download | nextcloud-server-0e0b4d55756e438111264423cc04baadb8b067a7.tar.gz nextcloud-server-0e0b4d55756e438111264423cc04baadb8b067a7.zip |
Hide remove image, if there's no custom avatar
Fix #7308
Diffstat (limited to 'settings/js/personal.js')
-rw-r--r-- | settings/js/personal.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/settings/js/personal.js b/settings/js/personal.js index ef261b50bbc..77c06f26a6a 100644 --- a/settings/js/personal.js +++ b/settings/js/personal.js @@ -58,6 +58,8 @@ function updateAvatar (hidedefault) { } $displaydiv.css({'background-color': ''}); $displaydiv.avatar(OC.currentUser, 128, true); + + $('#removeavatar').show(); } function showAvatarCropper() { @@ -254,6 +256,7 @@ $(document).ready(function(){ url: OC.Router.generate('core_avatar_delete'), success: function(msg) { updateAvatar(true); + $('#removeavatar').hide(); } }); }); @@ -276,6 +279,17 @@ $(document).ready(function(){ t('core', 'Strong password') ] }); + + // does the user have a custom avatar? if he does hide #removeavatar + // needs to be this complicated because we can't check yet if an avatar has been loaded, because it's async + OC.Router.registerLoadedCallback(function() { + var url = OC.Router.generate('core_avatar_get', {user: OC.currentUser, size: 1})+'?requesttoken='+oc_requesttoken; + $.get(url, function(result) { + if (typeof(result) === 'object') { + $('#removeavatar').hide(); + } + }); + }); } ); OC.Encryption = { |