From 7c14e1a5bd9c7c7b95923574ae05dec7bbb0df22 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ng=C3=B4=20Ng=E1=BB=8Dc=20=C4=90=E1=BB=A9c=20Huy?=
 <huyngo@disroot.org>
Date: Wed, 2 Aug 2023 08:40:19 +0700
Subject: [PATCH] Add replying info for redraft

---
 src/components/extra_buttons/extra_buttons.js | 32 ++++++++++++-------
 1 file changed, 20 insertions(+), 12 deletions(-)

diff --git a/src/components/extra_buttons/extra_buttons.js b/src/components/extra_buttons/extra_buttons.js
index 14c605fb..b38876b8 100644
--- a/src/components/extra_buttons/extra_buttons.js
+++ b/src/components/extra_buttons/extra_buttons.js
@@ -136,18 +136,26 @@ const ExtraButtons = {
     },
     doRedraftStatus () {
       this.$store.dispatch('fetchStatusSource', { id: this.status.id })
-        .then(data => this.$store.dispatch('openPostStatusModal', {
-          isRedraft: true,
-          statusId: this.status.id,
-          subject: data.spoiler_text,
-          statusText: data.text,
-          statusIsSensitive: this.status.nsfw,
-          statusPoll: this.status.poll,
-          statusFiles: [...this.status.attachments],
-          statusScope: this.status.visibility,
-          statusLanguage: this.status.language,
-          statusContentType: data.content_type
-        }))
+        .then(data => {
+          let repliedUserId = this.status.in_reply_to_user_id;
+          let repliedUser = this.status.attentions.filter(user =>
+            user.id === repliedUserId);
+          this.$store.dispatch('openPostStatusModal', {
+            isRedraft: true,
+            attentions: this.status.attentions,
+            statusId: this.status.id,
+            subject: data.spoiler_text,
+            statusText: data.text,
+            statusIsSensitive: this.status.nsfw,
+            statusPoll: this.status.poll,
+            statusFiles: [...this.status.attachments],
+            statusScope: this.status.visibility,
+            statusLanguage: this.status.language,
+            statusContentType: data.content_type,
+            replyTo: this.status.in_reply_to_status_id,
+            repliedUser: repliedUser
+          })
+        })
       this.doDeleteStatus()
     },
     showRedraftStatusConfirmDialog () {