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 90bc04e681b..7ba98ad19ef 100644 --- a/app/assets/javascripts/discourse/app/mixins/composer-upload-uppy.js +++ b/app/assets/javascripts/discourse/app/mixins/composer-upload-uppy.js @@ -337,8 +337,14 @@ export default Mixin.create(ExtendableUploader, UppyS3Multipart, { this._setupUIPlugins(); this.uploadTargetBound = true; + this._uppyReady(); }, + // This should be overridden in a child component if you need to + // hook into uppy events and be sure that everything is already + // set up for _uppyInstance. + _uppyReady() {}, + @bind _handleUploadError(file, error, response) { this._removeInProgressUpload(file.id); diff --git a/app/assets/javascripts/discourse/app/mixins/uppy-upload.js b/app/assets/javascripts/discourse/app/mixins/uppy-upload.js index e37353001f1..8c5fcf1203b 100644 --- a/app/assets/javascripts/discourse/app/mixins/uppy-upload.js +++ b/app/assets/javascripts/discourse/app/mixins/uppy-upload.js @@ -224,8 +224,15 @@ export default Mixin.create(UppyS3Multipart, { this._useXHRUploads(); } } + + this._uppyReady(); }, + // This should be overridden in a child component if you need to + // hook into uppy events and be sure that everything is already + // set up for _uppyInstance. + _uppyReady() {}, + _startUpload() { if (!this.filesAwaitingUpload) { return; @@ -233,6 +240,7 @@ export default Mixin.create(UppyS3Multipart, { if (!this._uppyInstance?.getFiles().length) { return; } + this.set("uploading", true); return this._uppyInstance?.upload(); },