Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/channels/whatsapp.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,21 @@ describe('WhatsAppChannel', () => {
return p;
}

// --- Notification suppression ---

describe('notification suppression', () => {
it('passes markOnlineOnConnect: false to makeWASocket', async () => {
const opts = createTestOpts();
const channel = new WhatsAppChannel(opts);
await connectChannel(channel);

const { makeWASocket } = await import('@whiskeysockets/baileys');
expect(makeWASocket).toHaveBeenCalledWith(
expect.objectContaining({ markOnlineOnConnect: false }),
);
});
});

// --- Version fetch ---

describe('version fetch', () => {
Expand Down
6 changes: 1 addition & 5 deletions src/channels/whatsapp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ export class WhatsAppChannel implements Channel {
printQRInTerminal: false,
logger: baileysLogger,
browser: Browsers.macOS('Chrome'),
markOnlineOnConnect: false,
cachedGroupMetadata: async (jid: string) =>
this.getNormalizedGroupMetadata(jid),
getMessage: async (key: WAMessageKey) => {
Expand Down Expand Up @@ -187,11 +188,6 @@ export class WhatsAppChannel implements Channel {
this.connected = true;
logger.info('Connected to WhatsApp');

// Announce availability so WhatsApp relays subsequent presence updates (typing indicators)
this.sock.sendPresenceUpdate('available').catch((err) => {
logger.warn({ err }, 'Failed to send presence update');
});

// Build LID to phone mapping from auth state for self-chat translation
if (this.sock.user) {
const phoneUser = this.sock.user.id.split(':')[0];
Expand Down
Loading