DEV: Allow disabling composer submit (#17062)

…without overriding the computed property. Will fix warnings in discourse-perspective-api plugin.
This commit is contained in:
Jarek Radosz 2022-06-13 12:45:47 +02:00 committed by GitHub
parent e9a77e7f19
commit 8d0c2cd4f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 2 deletions

View File

@ -120,6 +120,25 @@ export default Controller.extend({
this.set("showPreview", val === "true"); this.set("showPreview", val === "true");
}, },
@computed(
"model.loading",
"isUploading",
"isProcessingUpload",
"_disableSubmit"
)
get disableSubmit() {
return (
this.model?.loading ||
this.isUploading ||
this.isProcessingUpload ||
this._disableSubmit
);
},
set disableSubmit(value) {
this.set("_disableSubmit", value);
},
@discourseComputed("showPreview") @discourseComputed("showPreview")
toggleText(showPreview) { toggleText(showPreview) {
return showPreview return showPreview
@ -803,8 +822,6 @@ export default Controller.extend({
}, },
}, },
disableSubmit: or("model.loading", "isUploading", "isProcessingUpload"),
save(force, options = {}) { save(force, options = {}) {
if (this.disableSubmit) { if (this.disableSubmit) {
return; return;