fix: restore dm command and self-chat auth behavior

This commit is contained in:
Peter Steinberger
2026-02-26 18:46:51 +01:00
parent 64de4b6d6a
commit 262bca9bdd
6 changed files with 116 additions and 17 deletions

View File

@@ -130,4 +130,31 @@ describe("WhatsApp dmPolicy precedence", () => {
expectSilentlyBlocked(result);
expect(readAllowFromStoreMock).not.toHaveBeenCalled();
});
it("always allows same-phone DMs even when allowFrom is restrictive", async () => {
setAccessControlTestConfig({
channels: {
whatsapp: {
dmPolicy: "pairing",
allowFrom: ["+15550001111"],
},
},
});
const result = await checkInboundAccessControl({
accountId: "default",
from: "+15550009999",
selfE164: "+15550009999",
senderE164: "+15550009999",
group: false,
pushName: "Owner",
isFromMe: false,
sock: { sendMessage: sendMessageMock },
remoteJid: "15550009999@s.whatsapp.net",
});
expect(result.allowed).toBe(true);
expect(upsertPairingRequestMock).not.toHaveBeenCalled();
expect(sendMessageMock).not.toHaveBeenCalled();
});
});