fix: use logical OR for sender ID fallback in command auth

The nullish coalescing operator (??) only skips null/undefined, not
empty strings. For direct WhatsApp messages, ctx.SenderId was an empty
string, causing senderRaw to be "" instead of falling through to the
valid ctx.SenderE164 value.

This caused commands like /status to be rejected with "unauthorized
sender" for self-chat WhatsApp messages.

Tested: Verified /status command now works correctly for self-chat
WhatsApp messages after the fix.
This commit is contained in:
juanpablodlc
2026-01-11 20:09:41 -08:00
committed by Peter Steinberger
parent e388334127
commit 20d606c4c4

View File

@@ -96,7 +96,7 @@ export function resolveCommandAuthorization(params: {
}
const ownerList = ownerCandidates;
const senderRaw = ctx.SenderId ?? ctx.SenderE164 ?? from;
const senderRaw = ctx.SenderId || ctx.SenderE164 || from;
const senderId = senderRaw
? formatAllowFromList({
dock,