diff --git a/src/core/engines/noweb/session.noweb.core.ts b/src/core/engines/noweb/session.noweb.core.ts index 90eff3af..9645c60b 100644 --- a/src/core/engines/noweb/session.noweb.core.ts +++ b/src/core/engines/noweb/session.noweb.core.ts @@ -698,7 +698,7 @@ export class WhatsappSessionNoWebCore extends WhatsappSession { this.sock.ev.on('messages.upsert', ({ messages }) => { const meId = this.sock?.authState?.creds?.me?.id; for (const message of messages) { - if (!isRealMessage(message, meId)) { + if (!isRealMessage(message)) { continue; } if (message.key.fromMe) { diff --git a/src/core/engines/noweb/store/NowebPersistentStore.ts b/src/core/engines/noweb/store/NowebPersistentStore.ts index f8ebe3f9..7a49b235 100644 --- a/src/core/engines/noweb/store/NowebPersistentStore.ts +++ b/src/core/engines/noweb/store/NowebPersistentStore.ts @@ -315,9 +315,7 @@ export class NowebPersistentStore implements INowebStore { Object.assign(message, fields); // In case of revoked messages - remove it // TODO: May be we should save the flag instead of completely removing the message - const isYetRealMessage = - esm.b.isRealMessage(message, this.socket?.authState?.creds?.me?.id) || - false; + const isYetRealMessage = esm.b.isRealMessage(message) || false; if (isYetRealMessage) { await this.messagesRepo.upsertOne(message); } else { diff --git a/src/core/engines/noweb/store/memory/make-in-memory-store.ts b/src/core/engines/noweb/store/memory/make-in-memory-store.ts index 88ed69c4..2106ba9b 100644 --- a/src/core/engines/noweb/store/memory/make-in-memory-store.ts +++ b/src/core/engines/noweb/store/memory/make-in-memory-store.ts @@ -346,8 +346,8 @@ export default (config: BaileysInMemoryStoreConfig) => { switch (action) { case 'add': metadata.participants.push( - ...participants.map((id) => ({ - id, + ...participants.map((participant) => ({ + id: participant.id, isAdmin: false, isSuperAdmin: false, })), @@ -356,7 +356,7 @@ export default (config: BaileysInMemoryStoreConfig) => { case 'demote': case 'promote': for (const participant of metadata.participants) { - if (participants.includes(participant.id)) { + if (participants.find((p) => p.id === participant.id)) { participant.isAdmin = action === 'promote'; } } @@ -364,7 +364,8 @@ export default (config: BaileysInMemoryStoreConfig) => { break; case 'remove': metadata.participants = metadata.participants.filter( - (p) => !participants.includes(p.id), + (participant) => + !participants.find((p) => p.id === participant.id), ); break; }