Skip to content
This repository has been archived by the owner on Oct 4, 2018. It is now read-only.

Commit

Permalink
Merge pull request owncloud#7340 from owncloud/hide_remove_image_avatar
Browse files Browse the repository at this point in the history
Hide remove image, if there's no custom avatar
  • Loading branch information
MorrisJobke committed Mar 13, 2014
2 parents 9fa9c79 + 8fafee3 commit 3c03ff5
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions settings/js/personal.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ function updateAvatar (hidedefault) {
}
$displaydiv.css({'background-color': ''});
$displaydiv.avatar(OC.currentUser, 128, true);

$('#removeavatar').show();
}

function showAvatarCropper() {
Expand Down Expand Up @@ -256,6 +258,7 @@ $(document).ready(function(){
url: OC.generateUrl('/avatar/'),
success: function(msg) {
updateAvatar(true);
$('#removeavatar').hide();
}
});
});
Expand All @@ -278,6 +281,18 @@ $(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
var url = OC.generateUrl(
'/avatar/{user}/{size}',
{user: OC.currentUser, size: 1}
) + '?requesttoken=' + oc_requesttoken;
$.get(url, function(result) {
if (typeof(result) === 'object') {
$('#removeavatar').hide();
}
});
} );

OC.Encryption = {
Expand Down

0 comments on commit 3c03ff5

Please sign in to comment.