From f9e877dbff4aa79c3ef9fce3c8d25cfd084f2686 Mon Sep 17 00:00:00 2001 From: Martin Brennan Date: Mon, 16 Aug 2021 09:55:55 +1000 Subject: [PATCH] FIX: Composer Processing/Uploading status not clearing on cancel and trash (#14050) When the composer reply is cancelled and the draft is trashed, the isUploading and isProcessing statuses were not being reset, so when the composer was opened again the Uploading... or Processing... message still showed even when the uploads had been cancelled correctly. The regular composer-upload mixin suffered the same problem as the uppy one, where the Processing/Uploading message was not reset when a reply was cancelled and the draft destroyed. --- .../discourse/app/mixins/composer-upload-uppy.js | 2 ++ .../javascripts/discourse/app/mixins/composer-upload.js | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/app/assets/javascripts/discourse/app/mixins/composer-upload-uppy.js b/app/assets/javascripts/discourse/app/mixins/composer-upload-uppy.js index af1a98571b5..961f690a68e 100644 --- a/app/assets/javascripts/discourse/app/mixins/composer-upload-uppy.js +++ b/app/assets/javascripts/discourse/app/mixins/composer-upload-uppy.js @@ -60,6 +60,8 @@ export default Mixin.create({ this.appEvents.off("composer:add-files", this._addFiles.bind(this)); + this._reset(); + if (this._uppyInstance) { this._uppyInstance.close(); this._uppyInstance = null; diff --git a/app/assets/javascripts/discourse/app/mixins/composer-upload.js b/app/assets/javascripts/discourse/app/mixins/composer-upload.js index 72ebf67e90a..5dbbbb94a66 100644 --- a/app/assets/javascripts/discourse/app/mixins/composer-upload.js +++ b/app/assets/javascripts/discourse/app/mixins/composer-upload.js @@ -129,6 +129,13 @@ export default Mixin.create({ const $element = $(this.element); + this.setProperties({ + uploadProgress: 0, + isUploading: false, + isProcessingUpload: false, + isCancellable: false, + }); + $.blueimp.fileupload.prototype.processActions = this.uploadProcessorActions; $element.fileupload({