From 4a044d067a96af7481322885a8ca97f3d50aafbd Mon Sep 17 00:00:00 2001 From: tusooa Date: Fri, 10 Mar 2023 19:36:54 -0500 Subject: [PATCH] Handle situations where draft should be saved --- src/components/post_status_form/post_status_form.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index 49395947..7c0289c0 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -195,7 +195,8 @@ const PostStatusForm = { preview: null, previewLoading: false, emojiInputShown: false, - idempotencyKey: '' + idempotencyKey: '', + saveInhibited: true } }, computed: { @@ -310,9 +311,11 @@ const PostStatusForm = { this.autoPreview() this.updateIdempotencyKey() this.debouncedSaveDraft() + this.saveInhibited = false }, clearStatus () { const newStatus = this.newStatus + this.saveInhibited = true this.newStatus = { status: '', spoilerText: '', @@ -664,7 +667,7 @@ const PostStatusForm = { return propsToNative(props) }, saveDraft () { - if (this.newStatus.status) { + if (!this.saveInhibited) { console.debug('Saving status', this.newStatus) this.$store.dispatch('addOrSaveDraft', { draft: this.newStatus }) .then(id => {