Adjust contact pushName. Not save when in message.upsert and the pushName is from the instance name

This commit is contained in:
Andre Fontana 2024-09-27 15:01:35 -03:00
parent ca2387cc70
commit 1e5d62c777

View File

@ -1179,7 +1179,7 @@ export class BaileysStartupService extends ChannelStartupService {
const contactRaw: { remoteJid: string; pushName: string; profilePicUrl?: string; instanceId: string } = { const contactRaw: { remoteJid: string; pushName: string; profilePicUrl?: string; instanceId: string } = {
remoteJid: received.key.remoteJid, remoteJid: received.key.remoteJid,
pushName: received.key.fromMe ? '' : (received.key.fromMe == null ? '' : contact.pushName), pushName: received.key.fromMe ? '' : (received.key.fromMe == null ? '' : received.pushName),
profilePicUrl: (await this.profilePicture(received.key.remoteJid)).profilePictureUrl, profilePicUrl: (await this.profilePicture(received.key.remoteJid)).profilePictureUrl,
instanceId: this.instanceId, instanceId: this.instanceId,
}; };
@ -1189,13 +1189,6 @@ export class BaileysStartupService extends ChannelStartupService {
} }
if (contact) { if (contact) {
const contactRaw: { remoteJid: string; pushName: string; profilePicUrl?: string; instanceId: string } = {
remoteJid: received.key.remoteJid,
pushName: received.key.fromMe ? '' : (received.key.fromMe == null ? '' : contact.pushName),
profilePicUrl: (await this.profilePicture(received.key.remoteJid)).profilePictureUrl,
instanceId: this.instanceId,
};
this.sendDataWebhook(Events.CONTACTS_UPDATE, contactRaw); this.sendDataWebhook(Events.CONTACTS_UPDATE, contactRaw);
if (this.configService.get<Chatwoot>('CHATWOOT').ENABLED && this.localChatwoot?.enabled) { if (this.configService.get<Chatwoot>('CHATWOOT').ENABLED && this.localChatwoot?.enabled) {