mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-24 17:38:40 -06:00
fix(chatwoot): fix grupos
This commit is contained in:
parent
09911c472d
commit
8446be7646
@ -564,8 +564,10 @@ export class ChatwootService {
|
|||||||
let contact = await this.findContact(instance, chatId);
|
let contact = await this.findContact(instance, chatId);
|
||||||
|
|
||||||
if (contact) {
|
if (contact) {
|
||||||
const waProfilePictureFile = picture_url.profilePictureUrl.split('#')[0].split('?')[0].split('/').pop();
|
if (!body.key.fromMe) {
|
||||||
const chatwootProfilePictureFile = contact?.thumbnail?.split('#')[0].split('?')[0].split('/').pop();
|
const waProfilePictureFile =
|
||||||
|
picture_url?.profilePictureUrl?.split('#')[0].split('?')[0].split('/').pop() || '';
|
||||||
|
const chatwootProfilePictureFile = contact?.thumbnail?.split('#')[0].split('?')[0].split('/').pop() || '';
|
||||||
const pictureNeedsUpdate = waProfilePictureFile !== chatwootProfilePictureFile;
|
const pictureNeedsUpdate = waProfilePictureFile !== chatwootProfilePictureFile;
|
||||||
const nameNeedsUpdate =
|
const nameNeedsUpdate =
|
||||||
!contact.name ||
|
!contact.name ||
|
||||||
@ -581,9 +583,11 @@ export class ChatwootService {
|
|||||||
this.logger.verbose('update contact in chatwoot');
|
this.logger.verbose('update contact in chatwoot');
|
||||||
contact = await this.updateContact(instance, contact.id, {
|
contact = await this.updateContact(instance, contact.id, {
|
||||||
...(nameNeedsUpdate && { name: nameContact }),
|
...(nameNeedsUpdate && { name: nameContact }),
|
||||||
...(pictureNeedsUpdate && { avatar_url: picture_url.profilePictureUrl || null }),
|
...(waProfilePictureFile === '' && { avatar: null }),
|
||||||
|
...(pictureNeedsUpdate && { avatar_url: picture_url?.profilePictureUrl }),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
const jid = isGroup ? null : body.key.remoteJid;
|
const jid = isGroup ? null : body.key.remoteJid;
|
||||||
contact = await this.createContact(
|
contact = await this.createContact(
|
||||||
|
Loading…
Reference in New Issue
Block a user