Hide remove image, if there's no custom avatar

Fix #7308
This commit is contained in:
kondou 2014-02-20 21:53:59 +01:00
parent 917a505af4
commit 0e0b4d5575

View File

@ -58,6 +58,8 @@ function updateAvatar (hidedefault) {
} }
$displaydiv.css({'background-color': ''}); $displaydiv.css({'background-color': ''});
$displaydiv.avatar(OC.currentUser, 128, true); $displaydiv.avatar(OC.currentUser, 128, true);
$('#removeavatar').show();
} }
function showAvatarCropper() { function showAvatarCropper() {
@ -254,6 +256,7 @@ $(document).ready(function(){
url: OC.Router.generate('core_avatar_delete'), url: OC.Router.generate('core_avatar_delete'),
success: function(msg) { success: function(msg) {
updateAvatar(true); updateAvatar(true);
$('#removeavatar').hide();
} }
}); });
}); });
@ -276,6 +279,17 @@ $(document).ready(function(){
t('core', 'Strong password') 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 = { OC.Encryption = {