Fix draft saving and add tests

This commit is contained in:
tusooa 2025-02-18 17:42:50 -05:00
commit 690812f27c
No known key found for this signature in database
GPG key ID: 42AEC43D48433C51
8 changed files with 364 additions and 2 deletions

View file

@ -376,6 +376,14 @@ const PostStatusForm = {
this.newStatus.hasPoll
) && this.saveable
},
hasEmptyDraft () {
return this.newStatus.id && !(
this.newStatus.status ||
this.newStatus.spoilerText ||
this.newStatus.files?.length ||
this.newStatus.hasPoll
)
},
...mapGetters(['mergedConfig']),
...mapState(useInterfaceStore, {
mobileLayout: store => store.mobileLayout
@ -784,7 +792,7 @@ const PostStatusForm = {
this.$emit('draft-done')
}
})
} else if (this.newStatus.id) {
} else if (this.hasEmptyDraft) {
// There is a draft, but there is nothing in it, clear it
return this.abandonDraft()
.then(() => {

View file

@ -322,6 +322,7 @@
trigger="click"
placement="bottom"
:offset="{ y: 5 }"
:trigger-attrs="{ 'aria-label': $t('post_status.more_post_actions') }"
>
<template #trigger>
<FAIcon