[core] Up NOWEB 2025-10-10 - fixes

This commit is contained in:
devlikepro committed 2025-10-12 18:45:42 +07:00
1 parent 825a4152db
commit 02e5934e8f
3 files changed
+7 -8

No files matched your search

+1 -1
View File
@@ -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) {
@@ -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 {
@@ -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;
}