diff --git a/app/javascript/dashboard/components/widgets/conversation/ReplyBox.vue b/app/javascript/dashboard/components/widgets/conversation/ReplyBox.vue index 5ad5f66a4..23f339f46 100644 --- a/app/javascript/dashboard/components/widgets/conversation/ReplyBox.vue +++ b/app/javascript/dashboard/components/widgets/conversation/ReplyBox.vue @@ -964,6 +964,19 @@ export default { (item, index) => itemIndex !== index ); }, + setReplyToInPayload(payload) { + if (this.inReplyTo?.id) { + return { + ...payload, + contentAttributes: { + ...payload.contentAttributes, + in_reply_to: this.inReplyTo.id, + }, + }; + } + + return payload; + }, getMessagePayloadForWhatsapp(message) { const multipleMessagePayload = []; @@ -973,41 +986,41 @@ export default { const attachedFile = this.globalConfig.directUploadsEnabled ? attachment.blobSignedId : attachment.resource.file; - const attachmentPayload = { + let attachmentPayload = { conversationId: this.currentChat.id, files: [attachedFile], private: false, message: caption, sender: this.sender, }; + + attachmentPayload = this.setReplyToInPayload(attachmentPayload); multipleMessagePayload.push(attachmentPayload); caption = ''; }); } else { - const messagePayload = { + let messagePayload = { conversationId: this.currentChat.id, message, private: false, sender: this.sender, }; + + messagePayload = this.setReplyToInPayload(messagePayload); + multipleMessagePayload.push(messagePayload); } return multipleMessagePayload; }, getMessagePayload(message) { - const messagePayload = { + let messagePayload = { conversationId: this.currentChat.id, message, private: this.isPrivate, sender: this.sender, }; - - if (this.inReplyTo?.id) { - messagePayload.contentAttributes = { - in_reply_to: this.inReplyTo.id, - }; - } + messagePayload = this.setReplyToInPayload(messagePayload); if (this.attachedFiles && this.attachedFiles.length) { messagePayload.files = []; diff --git a/app/javascript/dashboard/components/widgets/conversation/bubble/ReplyTo.vue b/app/javascript/dashboard/components/widgets/conversation/bubble/ReplyTo.vue index 06b6f0445..fb557293b 100644 --- a/app/javascript/dashboard/components/widgets/conversation/bubble/ReplyTo.vue +++ b/app/javascript/dashboard/components/widgets/conversation/bubble/ReplyTo.vue @@ -1,10 +1,11 @@