fix: First attachment with caption for whatsapp channel (#6486)

This commit is contained in:
Clairton Rodrigo Heinzen
2023-02-22 09:50:10 -03:00
committed by GitHub
parent cd6a836bf6
commit 8935933266

View File

@@ -968,15 +968,9 @@ export default {
}, },
getMessagePayloadForWhatsapp(message) { getMessagePayloadForWhatsapp(message) {
const multipleMessagePayload = []; const multipleMessagePayload = [];
const messagePayload = {
conversationId: this.currentChat.id,
message,
private: false,
};
multipleMessagePayload.push(messagePayload);
if (this.attachedFiles && this.attachedFiles.length) { if (this.attachedFiles && this.attachedFiles.length) {
let caption = message;
this.attachedFiles.forEach(attachment => { this.attachedFiles.forEach(attachment => {
const attachedFile = this.globalConfig.directUploadsEnabled const attachedFile = this.globalConfig.directUploadsEnabled
? attachment.blobSignedId ? attachment.blobSignedId
@@ -985,10 +979,18 @@ export default {
conversationId: this.currentChat.id, conversationId: this.currentChat.id,
files: [attachedFile], files: [attachedFile],
private: false, private: false,
message: '', message: caption,
}; };
multipleMessagePayload.push(attachmentPayload); multipleMessagePayload.push(attachmentPayload);
caption = '';
}); });
} else {
const messagePayload = {
conversationId: this.currentChat.id,
message,
private: false,
};
multipleMessagePayload.push(messagePayload);
} }
return multipleMessagePayload; return multipleMessagePayload;