Handle situations where draft should be saved

This commit is contained in:
tusooa 2023-03-10 19:36:54 -05:00
parent 050266ee39
commit 4a044d067a
No known key found for this signature in database
GPG Key ID: 42AEC43D48433C51
1 changed files with 5 additions and 2 deletions

View File

@ -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 => {