fix(whatsapp): honor dm_policy and group_policy open at the gateway

This commit is contained in:
Zyrixtrex
2026-06-01 19:51:21 -07:00
committed by Teknium
parent d4b533de4e
commit 0cd5867bbb
4 changed files with 18 additions and 8 deletions
+2 -2
View File
@@ -1750,8 +1750,8 @@ class BasePlatformAdapter(ABC):
def enforces_own_access_policy(self) -> bool:
"""Whether this adapter gates inbound access before dispatch.
Some adapters (WeCom, Weixin, Yuanbao, QQBot) implement a documented
config-driven access surface — ``dm_policy`` / ``group_policy`` /
Some adapters (WeCom, Weixin, Yuanbao, QQBot, WhatsApp) implement a
documented config-driven access surface — ``dm_policy`` / ``group_policy`` /
``allow_from`` / ``group_allow_from`` in ``PlatformConfig.extra`` — and
enforce it at intake: a message is dropped inside the adapter and never
reaches the gateway unless it already passed that policy.
+5
View File
@@ -379,6 +379,11 @@ class WhatsAppAdapter(BasePlatformAdapter):
return True
return False
@property
def enforces_own_access_policy(self) -> bool:
"""WhatsApp gates DM/group access at intake via dm_policy/group_policy."""
return True
def _is_dm_allowed(self, sender_id: str) -> bool:
"""Check whether a DM from the given sender should be processed."""
if self._dm_policy == "disabled":