diff --git a/app/assets/javascripts/discourse/app/components/avatar-uploader.hbs b/app/assets/javascripts/discourse/app/components/avatar-uploader.hbs index d410bde3f23..cd0ad6e5348 100644 --- a/app/assets/javascripts/discourse/app/components/avatar-uploader.hbs +++ b/app/assets/javascripts/discourse/app/components/avatar-uploader.hbs @@ -1,4 +1,5 @@ { + this.setProperties({ + imageIsNotASquare: upload.width !== upload.height, + uploadedAvatarTemplate: upload.url, + uploadedAvatarId: upload.id, + }); + + this.done(); + }, + additionalParams: () => ({ + user_id: this.user_id, + }), + }); + imageIsNotASquare = false; - @discourseComputed("uploading", "uploadedAvatarId") + @discourseComputed("uppyUpload.uploading", "uploadedAvatarId") customAvatarUploaded() { - return !this.uploading && !isBlank(this.uploadedAvatarId); + return !this.uppyUpload.uploading && !isBlank(this.uploadedAvatarId); } - validateUploadedFilesOptions() { - return { imagesOnly: true }; - } - - uploadDone(upload) { - this.setProperties({ - imageIsNotASquare: upload.width !== upload.height, - uploadedAvatarTemplate: upload.url, - uploadedAvatarId: upload.id, - }); - - this.done(); - } - - @discourseComputed("user_id") - data(user_id) { - return { user_id }; - } - - @discourseComputed("uploading", "uploadProgress") + @discourseComputed("uppyUpload.uploading", "uppyUpload.uploadProgress") uploadLabel() { - return this.uploading - ? `${I18n.t("uploading")} ${this.uploadProgress}%` + return this.uppyUpload.uploading + ? `${I18n.t("uploading")} ${this.uppyUpload.uploadProgress}%` : I18n.t("upload"); } @action chooseImage() { - this.fileInputEl.click(); + this.uppyUpload.openPicker(); } }