mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-26 02:18:38 -06:00
Merge branch 'main' of https://github.com/instantsol/evolution-api into QnixXBLF
This commit is contained in:
commit
3f4ba1ac2a
@ -867,7 +867,6 @@ export class BaileysStartupService extends ChannelStartupService {
|
|||||||
|
|
||||||
'contacts.update': async (contacts: Partial<Contact>[], database: Database) => {
|
'contacts.update': async (contacts: Partial<Contact>[], database: Database) => {
|
||||||
this.logger.verbose('Event received: contacts.update');
|
this.logger.verbose('Event received: contacts.update');
|
||||||
|
|
||||||
this.logger.verbose('Verifying if contacts exists in database to update');
|
this.logger.verbose('Verifying if contacts exists in database to update');
|
||||||
const contactsRaw: ContactRaw[] = [];
|
const contactsRaw: ContactRaw[] = [];
|
||||||
for await (const contact of contacts) {
|
for await (const contact of contacts) {
|
||||||
@ -882,8 +881,9 @@ export class BaileysStartupService extends ChannelStartupService {
|
|||||||
this.logger.verbose('Sending data to webhook in event CONTACTS_UPDATE');
|
this.logger.verbose('Sending data to webhook in event CONTACTS_UPDATE');
|
||||||
this.sendDataWebhook(Events.CONTACTS_UPDATE, contactsRaw);
|
this.sendDataWebhook(Events.CONTACTS_UPDATE, contactsRaw);
|
||||||
|
|
||||||
|
//REMOVING DUE TO CREATING NULL CONTACTS ( ADDING FILTER )
|
||||||
this.logger.verbose('Updating contacts in database');
|
this.logger.verbose('Updating contacts in database');
|
||||||
this.repository.contact.update(contactsRaw, this.instance.name, database.SAVE_DATA.CONTACTS);
|
this.repository.contact.update(contactsRaw.filter(contact => contact.pushName), this.instance.name, database.SAVE_DATA.CONTACTS);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1059,7 +1059,7 @@ export class BaileysStartupService extends ChannelStartupService {
|
|||||||
settings: SettingsRaw,
|
settings: SettingsRaw,
|
||||||
) => {
|
) => {
|
||||||
try {
|
try {
|
||||||
this.logger.verbose('Event received: messages.upsert');
|
this.logger.verbose('Event received: messages.upsert');
|
||||||
for (const received of messages) {
|
for (const received of messages) {
|
||||||
if (
|
if (
|
||||||
this.localChatwoot.enabled &&
|
this.localChatwoot.enabled &&
|
||||||
@ -1246,6 +1246,10 @@ export class BaileysStartupService extends ChannelStartupService {
|
|||||||
owner: this.instance.name,
|
owner: this.instance.name,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (received?.key?.fromMe === true){
|
||||||
|
contactRaw.pushName = null
|
||||||
|
}
|
||||||
|
|
||||||
this.logger.verbose('Sending data to webhook in event CONTACTS_UPDATE');
|
this.logger.verbose('Sending data to webhook in event CONTACTS_UPDATE');
|
||||||
this.sendDataWebhook(Events.CONTACTS_UPDATE, contactRaw);
|
this.sendDataWebhook(Events.CONTACTS_UPDATE, contactRaw);
|
||||||
|
|
||||||
@ -1258,7 +1262,9 @@ export class BaileysStartupService extends ChannelStartupService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.logger.verbose('Updating contact in database');
|
this.logger.verbose('Updating contact in database');
|
||||||
await this.repository.contact.update([contactRaw], this.instance.name, database.SAVE_DATA.CONTACTS);
|
|
||||||
|
if(contactRaw.pushName)
|
||||||
|
await this.repository.contact.update([contactRaw], this.instance.name, database.SAVE_DATA.CONTACTS);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1269,10 +1275,10 @@ export class BaileysStartupService extends ChannelStartupService {
|
|||||||
|
|
||||||
this.logger.verbose('Inserting contact in database');
|
this.logger.verbose('Inserting contact in database');
|
||||||
|
|
||||||
if (received?.key?.fromMe === true) {
|
if (received?.key?.fromMe === true)
|
||||||
contactRaw.pushName = null;
|
contactRaw.pushName = null;
|
||||||
}
|
|
||||||
this.repository.contact.insert([contactRaw], this.instance.name, database.SAVE_DATA.CONTACTS);
|
this.repository.contact.insert([contactRaw], this.instance.name, database.SAVE_DATA.CONTACTS);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.logger.error(error);
|
this.logger.error(error);
|
||||||
|
Loading…
Reference in New Issue
Block a user