From ab1a8d10452d112fcfa4c1f98375942e06cae831 Mon Sep 17 00:00:00 2001 From: Luke Bennett Date: Tue, 17 Jul 2018 20:03:16 +0100 Subject: [PATCH 1/3] Delete unneeded user avatar formData --- app/assets/javascripts/profile/profile.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/profile/profile.js b/app/assets/javascripts/profile/profile.js index 8cf7f2f23d0..e49c67ffb5c 100644 --- a/app/assets/javascripts/profile/profile.js +++ b/app/assets/javascripts/profile/profile.js @@ -49,13 +49,15 @@ export default class Profile { saveForm() { const self = this; - const formData = new FormData(this.form[0]); + const formData = new FormData(this.form.get(0)); const avatarBlob = this.avatarGlCrop.getBlob(); if (avatarBlob != null) { formData.append('user[avatar]', avatarBlob, 'avatar.png'); } + formData.delete('user[avatar]-trigger'); + axios({ method: this.form.attr('method'), url: this.form.attr('action'), From 820c37716b6190db6c09e1be1a836df5554db518 Mon Sep 17 00:00:00 2001 From: Luke Bennett Date: Tue, 17 Jul 2018 20:06:58 +0100 Subject: [PATCH 2/3] add changelog entry --- .../45443-unable-to-save-user-profile-update-with-safari.yml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 changelogs/unreleased/45443-unable-to-save-user-profile-update-with-safari.yml diff --git a/changelogs/unreleased/45443-unable-to-save-user-profile-update-with-safari.yml b/changelogs/unreleased/45443-unable-to-save-user-profile-update-with-safari.yml new file mode 100644 index 00000000000..b18f7aec546 --- /dev/null +++ b/changelogs/unreleased/45443-unable-to-save-user-profile-update-with-safari.yml @@ -0,0 +1,5 @@ +--- +title: Resolve "Unable to save user profile update with Safari" +merge_request: 20676 +author: +type: fixed From 6d4f4caa64d04524380c0bf6aaadc80336f9ebea Mon Sep 17 00:00:00 2001 From: Luke Bennett Date: Fri, 20 Jul 2018 13:08:23 +0100 Subject: [PATCH 3/3] Add formdata-polyfill --- app/assets/javascripts/commons/polyfills.js | 1 + package.json | 1 + yarn.lock | 4 ++++ 3 files changed, 6 insertions(+) diff --git a/app/assets/javascripts/commons/polyfills.js b/app/assets/javascripts/commons/polyfills.js index d62d3c23654..f595f3c3187 100644 --- a/app/assets/javascripts/commons/polyfills.js +++ b/app/assets/javascripts/commons/polyfills.js @@ -14,6 +14,7 @@ import 'core-js/es6/weak-map'; // Browser polyfills import 'classlist-polyfill'; +import 'formdata-polyfill'; import './polyfills/custom_event'; import './polyfills/element'; import './polyfills/event'; diff --git a/package.json b/package.json index e1801d4d435..256ebc1fb6e 100644 --- a/package.json +++ b/package.json @@ -53,6 +53,7 @@ "emoji-unicode-version": "^0.2.1", "exports-loader": "^0.7.0", "file-loader": "^1.1.11", + "formdata-polyfill": "^3.0.11", "fuzzaldrin-plus": "^0.5.0", "glob": "^7.1.2", "imports-loader": "^0.8.0", diff --git a/yarn.lock b/yarn.lock index 67f9aa98c74..85fdb150d34 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3211,6 +3211,10 @@ form-data@~2.3.0, form-data@~2.3.1: combined-stream "1.0.6" mime-types "^2.1.12" +formdata-polyfill@^3.0.11: + version "3.0.11" + resolved "https://registry.yarnpkg.com/formdata-polyfill/-/formdata-polyfill-3.0.11.tgz#c82b4b4bea3356c0a6752219e54ce1edb2a7fb5b" + forwarded@~0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.1.2.tgz#98c23dab1175657b8c0573e8ceccd91b0ff18c84"