mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2026-01-14 07:42:27 -06:00
fix: when deleting a message in whatsapp, delete the message in chatwoot too
The message model schema was changed. Old format in message model was field chatwootMessageId. Now we have a document chatwoot with new properties. I cant find a simple way to create a migration function up then the old field was no migrate to new format.
This commit is contained in:
@@ -1798,7 +1798,11 @@ export class WAStartupService {
|
||||
);
|
||||
|
||||
if (chatwootSentMessage?.id) {
|
||||
messageRaw.chatwootMessageId = chatwootSentMessage.id;
|
||||
messageRaw.chatwoot = {
|
||||
messageId: chatwootSentMessage.id,
|
||||
inboxId: chatwootSentMessage.inbox_id,
|
||||
conversationId: chatwootSentMessage.conversation_id,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1941,6 +1945,22 @@ export class WAStartupService {
|
||||
this.instance.name,
|
||||
database.SAVE_DATA.MESSAGE_UPDATE,
|
||||
);
|
||||
|
||||
if (this.localChatwoot.enabled) {
|
||||
this.chatwootService.eventWhatsapp(
|
||||
Events.MESSAGES_DELETE,
|
||||
{ instanceName: this.instance.name },
|
||||
{
|
||||
key: {
|
||||
remoteJid: key.remoteJid,
|
||||
fromMe: key.fromMe,
|
||||
id: key.id,
|
||||
participant: key.participant,
|
||||
},
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user