Clear draft if it is empty
This commit is contained in:
parent
40c7236653
commit
89346369e0
|
@ -727,18 +727,24 @@ const PostStatusForm = {
|
||||||
},
|
},
|
||||||
saveDraft () {
|
saveDraft () {
|
||||||
if (!this.disableDraft &&
|
if (!this.disableDraft &&
|
||||||
!this.saveInhibited &&
|
!this.saveInhibited) {
|
||||||
(this.newStatus.status ||
|
if (this.newStatus.status ||
|
||||||
this.newStatus.files?.length ||
|
this.newStatus.files?.length ||
|
||||||
this.newStatus.hasPoll
|
this.newStatus.hasPoll) {
|
||||||
)) {
|
return this.$store.dispatch('addOrSaveDraft', { draft: this.newStatus })
|
||||||
return this.$store.dispatch('addOrSaveDraft', { draft: this.newStatus })
|
.then(id => {
|
||||||
.then(id => {
|
if (this.newStatus.id !== id) {
|
||||||
if (this.newStatus.id !== id) {
|
this.newStatus.id = id
|
||||||
this.newStatus.id = id
|
}
|
||||||
}
|
this.savable = false
|
||||||
this.savable = false
|
})
|
||||||
})
|
} else if (this.newStatus.id) {
|
||||||
|
// There is a draft, but there is nothing in it, clear it
|
||||||
|
return this.abandonDraft()
|
||||||
|
.then(() => {
|
||||||
|
this.savable = false
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return Promise.resolve()
|
return Promise.resolve()
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue