mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-16 04:02:54 -06:00
Fixing chatname on the events message.upsert and message.update in order to return always the chatname from the user correctly
This commit is contained in:
parent
402b37d7b4
commit
8c6f95fbef
@ -382,7 +382,7 @@ export class BaileysStartupService extends ChannelStartupService {
|
|||||||
qrcodeTerminal.generate(qr, { small: true }, (qrcode) =>
|
qrcodeTerminal.generate(qr, { small: true }, (qrcode) =>
|
||||||
this.logger.log(
|
this.logger.log(
|
||||||
`\n{ instance: ${this.instance.name} pairingCode: ${this.instance.qrcode.pairingCode}, qrcodeCount: ${this.instance.qrcode.count} }\n` +
|
`\n{ instance: ${this.instance.name} pairingCode: ${this.instance.qrcode.pairingCode}, qrcodeCount: ${this.instance.qrcode.count} }\n` +
|
||||||
qrcode,
|
qrcode,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -1023,18 +1023,18 @@ export class BaileysStartupService extends ChannelStartupService {
|
|||||||
|
|
||||||
const messagesRepository: Set<string> = new Set(
|
const messagesRepository: Set<string> = new Set(
|
||||||
chatwootImport.getRepositoryMessagesCache(instance) ??
|
chatwootImport.getRepositoryMessagesCache(instance) ??
|
||||||
(
|
(
|
||||||
await this.prismaRepository.message.findMany({
|
await this.prismaRepository.message.findMany({
|
||||||
select: { key: true },
|
select: { key: true },
|
||||||
where: { instanceId: this.instanceId },
|
where: { instanceId: this.instanceId },
|
||||||
})
|
})
|
||||||
).map((message) => {
|
).map((message) => {
|
||||||
const key = message.key as {
|
const key = message.key as {
|
||||||
id: string;
|
id: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
return key.id;
|
return key.id;
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (chatwootImport.getRepositoryMessagesCache(instance) === null) {
|
if (chatwootImport.getRepositoryMessagesCache(instance) === null) {
|
||||||
@ -1226,6 +1226,7 @@ export class BaileysStartupService extends ChannelStartupService {
|
|||||||
received.pushName &&
|
received.pushName &&
|
||||||
existingChat.name !== received.pushName &&
|
existingChat.name !== received.pushName &&
|
||||||
received.pushName.trim().length > 0 &&
|
received.pushName.trim().length > 0 &&
|
||||||
|
!received.key.fromMe &&
|
||||||
!received.key.remoteJid.includes('@g.us')
|
!received.key.remoteJid.includes('@g.us')
|
||||||
) {
|
) {
|
||||||
this.sendDataWebhook(Events.CHATS_UPSERT, [{ ...existingChat, name: received.pushName }]);
|
this.sendDataWebhook(Events.CHATS_UPSERT, [{ ...existingChat, name: received.pushName }]);
|
||||||
@ -1585,7 +1586,6 @@ export class BaileysStartupService extends ChannelStartupService {
|
|||||||
const chatToInsert = {
|
const chatToInsert = {
|
||||||
remoteJid: message.remoteJid,
|
remoteJid: message.remoteJid,
|
||||||
instanceId: this.instanceId,
|
instanceId: this.instanceId,
|
||||||
name: message.pushName || '',
|
|
||||||
unreadMessages: 0,
|
unreadMessages: 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user