proper disable

This commit is contained in:
Henry Jameson 2024-12-31 13:05:15 +02:00
commit acbb53d6a4
5 changed files with 47 additions and 7 deletions

View file

@ -352,6 +352,12 @@ const PostStatusForm = {
return this.$t('post_status.auto_save_nothing_new')
}
},
safeToSaveDraft () {
return this.newStatus.status ||
this.newStatus.spoilerText ||
this.newStatus.files?.length ||
this.newStatus.hasPoll
},
...mapGetters(['mergedConfig']),
...mapState({
mobileLayout: state => state.interface.mobileLayout
@ -747,9 +753,7 @@ const PostStatusForm = {
saveDraft () {
if (!this.disableDraft &&
!this.saveInhibited) {
if (this.newStatus.status ||
this.newStatus.files?.length ||
this.newStatus.hasPoll) {
if (this.safeToSaveDraft) {
return this.$store.dispatch('addOrSaveDraft', { draft: this.newStatus })
.then(id => {
if (this.newStatus.id !== id) {

View file

@ -339,6 +339,8 @@
v-if="!disableDraft"
class="menu-item dropdown-item dropdown-item-icon"
role="menu"
:disabled="!safeToSaveDraft"
:class="{ disabled: !safeToSaveDraft }"
@click.prevent="saveDraft"
@click="close"
>