From 3ca1b17589f22c7ad3ae0e1e30df5d9fa4033d7b Mon Sep 17 00:00:00 2001 From: Martin Brennan Date: Tue, 21 Dec 2021 15:53:44 +1000 Subject: [PATCH] DEV: Change images-uploader to use Uppy (#15375) Missed this one, it is only used for the selectable_avatars site setting. --- .../discourse/app/components/images-uploader.js | 10 +++++----- .../javascripts/discourse/app/mixins/uppy-upload.js | 3 +++ .../app/templates/components/images-uploader.hbs | 4 ++-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/app/assets/javascripts/discourse/app/components/images-uploader.js b/app/assets/javascripts/discourse/app/components/images-uploader.js index beeff06ccfd..50c2feeda7d 100644 --- a/app/assets/javascripts/discourse/app/components/images-uploader.js +++ b/app/assets/javascripts/discourse/app/components/images-uploader.js @@ -1,15 +1,15 @@ import Component from "@ember/component"; import I18n from "I18n"; -import UploadMixin from "discourse/mixins/upload"; +import UppyUploadMixin from "discourse/mixins/uppy-upload"; import discourseComputed from "discourse-common/utils/decorators"; -export default Component.extend(UploadMixin, { +export default Component.extend(UppyUploadMixin, { type: "avatar", tagName: "span", - @discourseComputed("uploading") - uploadButtonText(uploading) { - return uploading ? I18n.t("uploading") : I18n.t("upload"); + @discourseComputed("uploadingOrProcessing") + uploadButtonText(uploadingOrProcessing) { + return uploadingOrProcessing ? I18n.t("uploading") : I18n.t("upload"); }, validateUploadedFilesOptions() { diff --git a/app/assets/javascripts/discourse/app/mixins/uppy-upload.js b/app/assets/javascripts/discourse/app/mixins/uppy-upload.js index 8c5fcf1203b..0b59c07885b 100644 --- a/app/assets/javascripts/discourse/app/mixins/uppy-upload.js +++ b/app/assets/javascripts/discourse/app/mixins/uppy-upload.js @@ -1,4 +1,5 @@ import Mixin from "@ember/object/mixin"; +import { or } from "@ember/object/computed"; import EmberObject from "@ember/object"; import { ajax } from "discourse/lib/ajax"; import { @@ -42,6 +43,8 @@ export default Mixin.create(UppyS3Multipart, { return {}; }, + uploadingOrProcessing: or("uploading", "processing"), + @on("willDestroyElement") _destroy() { if (this.messageBus) { diff --git a/app/assets/javascripts/discourse/app/templates/components/images-uploader.hbs b/app/assets/javascripts/discourse/app/templates/components/images-uploader.hbs index b7c195cc65e..0795ff8ed0b 100644 --- a/app/assets/javascripts/discourse/app/templates/components/images-uploader.hbs +++ b/app/assets/javascripts/discourse/app/templates/components/images-uploader.hbs @@ -1,7 +1,7 @@ -