From 0dc2afb8261fc474bd46bcb1b57ab845fc1baf32 Mon Sep 17 00:00:00 2001
From: tusooa <tusooa@kazv.moe>
Date: Mon, 24 Jul 2023 19:13:37 -0400
Subject: [PATCH] Fix a bug where mentioning a user twice will not fill the
 mention into the textarea

---
 changelog.d/mention-twice.fix                          | 1 +
 src/components/post_status_modal/post_status_modal.js  | 4 ++++
 src/components/post_status_modal/post_status_modal.vue | 2 +-
 src/modules/postStatus.js                              | 6 ++++++
 4 files changed, 12 insertions(+), 1 deletion(-)
 create mode 100644 changelog.d/mention-twice.fix

diff --git a/changelog.d/mention-twice.fix b/changelog.d/mention-twice.fix
new file mode 100644
index 000000000..0e4b71dfd
--- /dev/null
+++ b/changelog.d/mention-twice.fix
@@ -0,0 +1 @@
+Fix a bug where mentioning a user twice will not fill the mention into the textarea
diff --git a/src/components/post_status_modal/post_status_modal.js b/src/components/post_status_modal/post_status_modal.js
index b44354db1..8970dd9bc 100644
--- a/src/components/post_status_modal/post_status_modal.js
+++ b/src/components/post_status_modal/post_status_modal.js
@@ -44,6 +44,10 @@ const PostStatusModal = {
   methods: {
     closeModal () {
       this.$store.dispatch('closePostStatusModal')
+    },
+    resetAndClose () {
+      this.$store.dispatch('resetPostStatusModal')
+      this.$store.dispatch('closePostStatusModal')
     }
   }
 }
diff --git a/src/components/post_status_modal/post_status_modal.vue b/src/components/post_status_modal/post_status_modal.vue
index dbcd321eb..bc2cad4a1 100644
--- a/src/components/post_status_modal/post_status_modal.vue
+++ b/src/components/post_status_modal/post_status_modal.vue
@@ -12,7 +12,7 @@
       <PostStatusForm
         class="panel-body"
         v-bind="params"
-        @posted="closeModal"
+        @posted="resetAndClose"
       />
     </div>
   </Modal>
diff --git a/src/modules/postStatus.js b/src/modules/postStatus.js
index 638c1fb20..d3bea1378 100644
--- a/src/modules/postStatus.js
+++ b/src/modules/postStatus.js
@@ -10,6 +10,9 @@ const postStatus = {
     },
     closePostStatusModal (state) {
       state.modalActivated = false
+    },
+    resetPostStatusModal (state) {
+      state.params = null
     }
   },
   actions: {
@@ -18,6 +21,9 @@ const postStatus = {
     },
     closePostStatusModal ({ commit }) {
       commit('closePostStatusModal')
+    },
+    resetPostStatusModal ({ commit }) {
+      commit('resetPostStatusModal')
     }
   }
 }
-- 
GitLab