From 6cfc5c6a5ed80d2b4fc3793ee08fc47706ecef6d Mon Sep 17 00:00:00 2001 From: Jamie Schembri Date: Sat, 23 Jun 2018 19:50:50 +0200 Subject: Fix #39604 - Update header avatar after user changes avatar --- app/assets/javascripts/profile/profile.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'app/assets/javascripts/profile') diff --git a/app/assets/javascripts/profile/profile.js b/app/assets/javascripts/profile/profile.js index 5d58d968d30..8cf7f2f23d0 100644 --- a/app/assets/javascripts/profile/profile.js +++ b/app/assets/javascripts/profile/profile.js @@ -61,7 +61,13 @@ export default class Profile { url: this.form.attr('action'), data: formData, }) - .then(({ data }) => flash(data.message, 'notice')) + .then(({ data }) => { + if (avatarBlob != null) { + this.updateHeaderAvatar(); + } + + flash(data.message, 'notice'); + }) .then(() => { window.scrollTo(0, 0); // Enable submit button after requests ends @@ -70,6 +76,10 @@ export default class Profile { .catch(error => flash(error.message)); } + updateHeaderAvatar() { + $('.header-user-avatar').attr('src', this.avatarGlCrop.dataURL); + } + setRepoRadio() { const multiEditRadios = $('input[name="user[multi_file]"]'); if (this.newRepoActivated || this.newRepoActivated === 'true') { -- cgit v1.2.3