summaryrefslogtreecommitdiffstats
path: root/settings
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2016-12-08 13:44:26 +0100
committerGitHub <noreply@github.com>2016-12-08 13:44:26 +0100
commitce707912b47dcd78cdf451cc6af3aa7d75db3d1c (patch)
tree14f8b1af5534d5b71d4a725a8ec79d79cccf8bec /settings
parent74d1b0bada1b291038c88cf1e289d6696c65bfb7 (diff)
parent73c4112770753dd90f2cce6af47663bb009bc674 (diff)
downloadnextcloud-server-ce707912b47dcd78cdf451cc6af3aa7d75db3d1c.tar.gz
nextcloud-server-ce707912b47dcd78cdf451cc6af3aa7d75db3d1c.zip
Merge pull request #2534 from nextcloud/fix-avatar-upload-buttons
Fix avatar delete button
Diffstat (limited to 'settings')
-rw-r--r--settings/js/personal.js37
1 files changed, 11 insertions, 26 deletions
diff --git a/settings/js/personal.js b/settings/js/personal.js
index d1dd8c09ec1..f9a4517633a 100644
--- a/settings/js/personal.js
+++ b/settings/js/personal.js
@@ -65,16 +65,9 @@ function updateAvatar (hidedefault) {
$displaydiv.avatar(OC.currentUser, 145, true, null, function() {
$displaydiv.removeClass('loading');
$('#displayavatar img').show();
- });
- $.get(OC.generateUrl(
- '/avatar/{user}/{size}',
- {
- user: OC.currentUser,
- size: 1
- }
- ), function (result) {
- if (typeof(result) === 'string') {
- // Show the delete button when the avatar is custom
+ if($('#displayavatar img').length === 0) {
+ $('#removeavatar').removeClass('inlineblock').addClass('hidden');
+ } else {
$('#removeavatar').removeClass('hidden').addClass('inlineblock');
}
});
@@ -314,7 +307,6 @@ $(document).ready(function () {
url: OC.generateUrl('/avatar/'),
success: function () {
updateAvatar(true);
- $('#removeavatar').addClass('hidden').removeClass('inlineblock');
}
});
});
@@ -341,24 +333,17 @@ $(document).ready(function () {
drawTitles: true,
});
- // does the user have a custom avatar? if he does show #removeavatar
- $.get(OC.generateUrl(
- '/avatar/{user}/{size}',
- {
- user: OC.currentUser,
- size: 1
- }
- ), function (result) {
- if (typeof(result) === 'string') {
- // Show the delete button when the avatar is custom
- $('#removeavatar').removeClass('hidden').addClass('inlineblock');
- }
- });
-
// Load the big avatar
if (oc_config.enable_avatars) {
- $('#avatarform .avatardiv').avatar(OC.currentUser, 145);
+ $('#avatarform .avatardiv').avatar(OC.currentUser, 145, true, null, function() {
+ if($('#displayavatar img').length === 0) {
+ $('#removeavatar').removeClass('inlineblock').addClass('hidden');
+ } else {
+ $('#removeavatar').removeClass('hidden').addClass('inlineblock');
+ }
+ });
}
+
// Show token views
var collection = new OC.Settings.AuthTokenCollection();