mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-01 19:48:08 +00:00
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 = [];
|
||||
|
@@ -1,10 +1,11 @@
|
||||
<template>
|
||||
<div
|
||||
class="px-2 py-1.5 -mx-2 rounded-sm min-w-[15rem] mb-2"
|
||||
class="px-2 py-1.5 rounded-sm min-w-[10rem] mb-2"
|
||||
:class="{
|
||||
'bg-slate-100 dark:bg-slate-600 dark:text-slate-50':
|
||||
messageType === MESSAGE_TYPE.INCOMING,
|
||||
'bg-woot-600 text-woot-50': messageType === MESSAGE_TYPE.OUTGOING,
|
||||
'-mx-2': message.content,
|
||||
}"
|
||||
>
|
||||
<message-preview
|
||||
|
Reference in New Issue
Block a user