[core] NOWEB - Ignore history sync notification

This commit is contained in:
devlikepro committed 2025-11-04 14:00:25 +07:00
1 parent 744ee1abb1
commit 984ef0c6a1
2 files changed
+25 -1

No files matched your search

+8 -1
View File
@@ -199,7 +199,10 @@ import { NowebPersistentStore } from './store/NowebPersistentStore';
import { NowebStorageFactoryCore } from './store/NowebStorageFactoryCore';
import { ensureNumber, extractMediaContent } from './utils';
import { Agents } from '@waha/core/engines/noweb/types';
import { IsEditedMessage } from '@waha/core/utils/pwa';
import {
IsEditedMessage,
IsHistorySyncNotification,
} from '@waha/core/utils/pwa';
// eslint-disable-next-line @typescript-eslint/no-var-requires
const promiseRetry = require('promise-retry');
@@ -2198,6 +2201,10 @@ export class WhatsappSessionNoWebCore extends WhatsappSession {
return;
// Ignore edit, we have a dedicated event for that
if (IsEditedMessage(message.message)) return;
// Ignore history sync notifications
if (IsHistorySyncNotification(message.message)) return;
if (
message.message?.protocolMessage?.type ===
proto.Message.ProtocolMessage.Type.EPHEMERAL_SYNC_RESPONSE
+17
View File
@@ -20,3 +20,20 @@ export function IsEditedMessage(message: proto.IMessage): boolean {
}
return true;
}
export function IsHistorySyncNotification(message: proto.IMessage): boolean {
message = normalizeMessageContent(message);
if (!message) {
return false;
}
if (
message?.protocolMessage?.type !==
proto.Message.ProtocolMessage.Type.HISTORY_SYNC_NOTIFICATION
) {
return false;
}
if (message?.protocolMessage?.historySyncNotification == null) {
return false;
}
return true;
}