feat: support reply to for outgoing message in WhatsApp (#8107)
- This PR enables replies to WhatsApp.
This commit is contained in:
@@ -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 = [];
|
||||
|
||||
Reference in New Issue
Block a user