summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/profile
diff options
context:
space:
mode:
authorJamie Schembri <jamie@schembri.me>2018-06-23 19:50:50 +0200
committerJamie Schembri <jamie@schembri.me>2018-06-27 19:15:17 +0200
commit6cfc5c6a5ed80d2b4fc3793ee08fc47706ecef6d (patch)
tree4c13d0bbdda1d7cf1c7fda0bca312adfe63bb598 /app/assets/javascripts/profile
parent2bac2918b2d6f12d94f739f4b6865b9e9221c642 (diff)
downloadgitlab-ce-6cfc5c6a5ed80d2b4fc3793ee08fc47706ecef6d.tar.gz
Fix #39604 - Update header avatar after user changes avatar
Diffstat (limited to 'app/assets/javascripts/profile')
-rw-r--r--app/assets/javascripts/profile/profile.js12
1 files changed, 11 insertions, 1 deletions
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') {