From 769e98f63eaf2d67644d4c48638b8f1d9eacb82b Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Thu, 16 Apr 2020 17:02:23 +0200 Subject: [PATCH] javascript: fix the progress bar removal on success MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When using auto-attach, the response HTML fragment replaces the progress bar – so it doesn't need to be removed twice. --- app/javascript/shared/activestorage/uploader.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/javascript/shared/activestorage/uploader.js b/app/javascript/shared/activestorage/uploader.js index 1d1dcce8b..2c1c081de 100644 --- a/app/javascript/shared/activestorage/uploader.js +++ b/app/javascript/shared/activestorage/uploader.js @@ -30,11 +30,12 @@ export default class Uploader { if (this.autoAttachUrl) { await this._attach(blobSignedId); + // On response, the attachment HTML fragment will replace the progress bar. + } else { + this.progressBar.end(); + this.progressBar.destroy(); } - this.progressBar.end(); - this.progressBar.destroy(); - return blobSignedId; } catch (error) { this.progressBar.error(error.message);