From f77aeeb34c59e7faed30f28e3035b31f38a2a3dd Mon Sep 17 00:00:00 2001 From: John Lin Date: Wed, 28 Jan 2026 10:20:47 +0800 Subject: [PATCH] refactor(ringcentral): skip DM policy checks in selfOnly mode In selfOnly mode, dmPolicy/allowFrom/groupPolicy settings are now completely ignored since the owner is always allowed. This simplifies the logic and avoids confusion. Updated README to clarify which settings apply in selfOnly mode. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> --- extensions/ringcentral/README.md | 4 ++++ extensions/ringcentral/src/monitor.ts | 8 +++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/extensions/ringcentral/README.md b/extensions/ringcentral/README.md index 2207e0016..509955df2 100644 --- a/extensions/ringcentral/README.md +++ b/extensions/ringcentral/README.md @@ -78,6 +78,10 @@ export RINGCENTRAL_JWT="your-jwt-token" | `allowOtherChats` | boolean | `false` | In selfOnly mode, allow chats other than Personal | | `name` | string | - | Bot display name | | `textChunkLimit` | number | `4000` | Maximum characters per message chunk | +| `dmPolicy` | string | `"pairing"` | DM policy (only applies when `selfOnly: false`) | +| `groupPolicy` | string | `"allowlist"` | Group policy (only applies when `selfOnly: false`) | + +> **Note:** When `selfOnly: true` (default), the `dmPolicy`, `allowFrom`, `groupPolicy`, and related settings are ignored. The bot only responds to the JWT user in their Personal chat. ## Usage diff --git a/extensions/ringcentral/src/monitor.ts b/extensions/ringcentral/src/monitor.ts index 91c2f8bbb..e3106cfbb 100644 --- a/extensions/ringcentral/src/monitor.ts +++ b/extensions/ringcentral/src/monitor.ts @@ -330,17 +330,15 @@ async function processMessageWithPipeline(params: { } } - if (!isGroup) { + // DM policy checks - skip entirely in selfOnly mode (owner is always allowed) + if (!isGroup && !selfOnly) { const dmEnabled = account.config.dm?.enabled !== false; if (dmPolicy === "disabled" || !dmEnabled) { logVerbose(core, runtime, `Blocked RingCentral DM from ${senderId} (dmPolicy=disabled)`); return; } - // In selfOnly mode, always allow the owner - const isOwner = selfOnly && ownerId && senderId === ownerId; - - if (dmPolicy !== "open" && !isOwner) { + if (dmPolicy !== "open") { const allowed = senderAllowedForCommands; if (!allowed) { if (dmPolicy === "pairing") {