From 91500ee4b0ae4e2ce33b534338536079c83516f4 Mon Sep 17 00:00:00 2001 From: tusooa Date: Thu, 22 Aug 2024 20:13:56 -0400 Subject: [PATCH] Disable drafts for chats --- src/components/chat/chat.vue | 1 + src/components/post_status_form/post_status_form.js | 6 ++++-- src/components/post_status_form/post_status_form.vue | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/components/chat/chat.vue b/src/components/chat/chat.vue index 6efe576b..57158aba 100644 --- a/src/components/chat/chat.vue +++ b/src/components/chat/chat.vue @@ -76,6 +76,7 @@ :disable-sensitivity-checkbox="true" :disable-submit="errorLoadingChat || !currentChat" :disable-preview="true" + :disable-draft="true" :optimistic-posting="true" :post-handler="sendMessage" :submit-on-enter="!mobileLayout" diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index 2a20fe60..a8c36df4 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -93,6 +93,7 @@ const PostStatusForm = { 'disableSensitivityCheckbox', 'disableSubmit', 'disablePreview', + 'disableDraft', 'placeholder', 'maxHeight', 'postHandler', @@ -146,7 +147,7 @@ const PostStatusForm = { const [statusType, refId] = typeAndRefId({ replyTo: this.replyTo, profileMention: this.profileMention, statusId: this.statusId }) // If we are starting a new post, do not associate it with old drafts - let statusParams = (this.draftId || statusType !== 'new') ? this.getDraft(statusType, refId) : null + let statusParams = !this.disableDraft && (this.draftId || statusType !== 'new') ? this.getDraft(statusType, refId) : null if (!statusParams) { if (statusType === 'reply' || statusType === 'mention') { @@ -725,7 +726,8 @@ const PostStatusForm = { return propsToNative(props) }, saveDraft () { - if (!this.saveInhibited && + if (!this.disableDraft && + !this.saveInhibited && (this.newStatus.status || this.newStatus.files?.length || this.newStatus.hasPoll diff --git a/src/components/post_status_form/post_status_form.vue b/src/components/post_status_form/post_status_form.vue index 82daee72..8af9925d 100644 --- a/src/components/post_status_form/post_status_form.vue +++ b/src/components/post_status_form/post_status_form.vue @@ -298,13 +298,13 @@ {{ autoSaveState }}