wf_akkoma-fe/patches/pr416_04_reset-post-form-on-send.patch

54 lines
2.2 KiB
Diff

From 65dbac098eb39a862c1f3d4bd45f89208e72c4a5 Mon Sep 17 00:00:00 2001
From: novenary <novenary@kwak.zip>
Date: Tue, 17 Sep 2024 10:59:08 +0300
Subject: [PATCH] post_status_form: reset all to defaults on clear
---
.../post_status_form/post_status_form.js | 14 ++++++++++----
.../post_status_form/post_status_form.vue | 1 +
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js
index 6eee23ce..ac3e7b23 100644
--- a/src/components/post_status_form/post_status_form.js
+++ b/src/components/post_status_form/post_status_form.js
@@ -341,17 +341,23 @@ const PostStatusForm = {
this.saveDraft()
},
clearStatus () {
- const newStatus = this.newStatus
+ const config = this.$store.getters.mergedConfig
+ const postLanguage = config.postLanguage || interfaceToISOLanguage(config.interfaceLanguage)
this.newStatus = {
status: '',
spoilerText: '',
files: [],
- visibility: newStatus.visibility,
- contentType: newStatus.contentType,
- language: newStatus.language,
+ nsfw: !!config.sensitiveByDefault,
+ visibility: this.suggestedVisibility(),
+ contentType: config.postContentType,
+ language: postLanguage,
poll: {},
mediaDescriptions: {}
}
+ const scopeselector = this.$refs.scopeselector
+ if (scopeselector) {
+ scopeselector.currentScope = this.newStatus.visibility
+ }
this.pollFormVisible = false
this.$refs.mediaUpload && this.$refs.mediaUpload.clearFile()
this.clearPollForm()
diff --git a/src/components/post_status_form/post_status_form.vue b/src/components/post_status_form/post_status_form.vue
index 085a06a2..1a56685b 100644
--- a/src/components/post_status_form/post_status_form.vue
+++ b/src/components/post_status_form/post_status_form.vue
@@ -195,6 +195,7 @@
:class="{ 'visibility-tray-edit': isEdit }"
>
<scope-selector
+ ref="scopeselector"
v-if="!disableVisibilitySelector"
:user-default="userDefaultScope"
:original-scope="copyMessageScope"