Skip to content

Commit 0e4a6f1

Browse files
authored
fix: quote replies in threads (#2487)
### 🎯 Goal It's perfectly normal to quote a message that is part of a thread, as long as it's quoted in the same thread. Looks like this logic has been broken for some time. This PR fixes it. ### 🛠 Implementation details Take a look at how quoted message is handled in `Channel`: ``` const messageData = { // ... quoted_message_id: parent_id === quotedMessage?.parent_id ? quotedMessage?.id : undefined }; ``` Quoting is allowed as long as the quoted message is part of the same thread, or both are regular non-thread messages. However, there was a mismatch in how `MessageInputFlat` displays a quoted message: it was always hidden for thread messages, which lead to confusing behavior. Now the logic is the same in both places.
1 parent 0480b46 commit 0e4a6f1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/components/MessageInput/MessageInputFlat.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ export const MessageInputFlat = <
4949
maxFilesLeft,
5050
message,
5151
numberOfUploads,
52+
parent,
5253
recordingController,
5354
setCooldownRemaining,
5455
text,
@@ -129,7 +130,7 @@ export const MessageInputFlat = <
129130

130131
// TODO: "!message" condition is a temporary fix for shared
131132
// state when editing a message (fix shared state issue)
132-
const displayQuotedMessage = !message && quotedMessage && !quotedMessage.parent_id;
133+
const displayQuotedMessage = !message && quotedMessage && quotedMessage.parent_id === parent?.id;
133134
const recordingEnabled = !!(recordingController.recorder && navigator.mediaDevices); // account for requirement on iOS as per this bug report: https://bugs.webkit.org/show_bug.cgi?id=252303
134135
const isRecording = !!recordingController.recordingState;
135136

0 commit comments

Comments
 (0)