From 89359332664da02d4820abe2dacf3de173900a0c Mon Sep 17 00:00:00 2001 From: Clairton Rodrigo Heinzen Date: Wed, 22 Feb 2023 09:50:10 -0300 Subject: [PATCH] fix: First attachment with caption for whatsapp channel (#6486) --- .../widgets/conversation/ReplyBox.vue | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/app/javascript/dashboard/components/widgets/conversation/ReplyBox.vue b/app/javascript/dashboard/components/widgets/conversation/ReplyBox.vue index 6e8c9c34c..416075d92 100644 --- a/app/javascript/dashboard/components/widgets/conversation/ReplyBox.vue +++ b/app/javascript/dashboard/components/widgets/conversation/ReplyBox.vue @@ -968,15 +968,9 @@ export default { }, getMessagePayloadForWhatsapp(message) { const multipleMessagePayload = []; - const messagePayload = { - conversationId: this.currentChat.id, - message, - private: false, - }; - - multipleMessagePayload.push(messagePayload); if (this.attachedFiles && this.attachedFiles.length) { + let caption = message; this.attachedFiles.forEach(attachment => { const attachedFile = this.globalConfig.directUploadsEnabled ? attachment.blobSignedId @@ -985,10 +979,18 @@ export default { conversationId: this.currentChat.id, files: [attachedFile], private: false, - message: '', + message: caption, }; multipleMessagePayload.push(attachmentPayload); + caption = ''; }); + } else { + const messagePayload = { + conversationId: this.currentChat.id, + message, + private: false, + }; + multipleMessagePayload.push(messagePayload); } return multipleMessagePayload;