fix: respect groupPolicy when explicit group configs exist

Fixes #3323

Previously, having ANY explicit group config in channels.<channel>.groups
would enable allowlist mode, blocking all groups not explicitly listed —
even when groupPolicy was set to 'open'.

Now allowlistEnabled only activates when groupPolicy === 'allowlist',
allowing explicit group configs (e.g., requireMention settings) to
coexist with groupPolicy: 'open' without creating an implicit allowlist.
This commit is contained in:
Tes Sal 2026-01-28 12:53:16 +00:00
parent da421b9ef7
commit 2e420c4e1b

View File

@ -110,7 +110,13 @@ export function resolveChannelGroupPolicy(params: {
}): ChannelGroupPolicy {
const { cfg, channel } = params;
const groups = resolveChannelGroups(cfg, channel, params.accountId);
const allowlistEnabled = Boolean(groups && Object.keys(groups).length > 0);
// Only enable allowlist when groupPolicy is explicitly "allowlist".
// This allows explicit group configs (e.g., requireMention) to coexist
// with groupPolicy: "open" without creating an implicit allowlist.
const channelConfig = cfg.channels?.[channel];
const groupPolicy = channelConfig?.groupPolicy ?? "open";
const allowlistEnabled =
groupPolicy === "allowlist" && Boolean(groups && Object.keys(groups).length > 0);
const normalizedId = params.groupId?.trim();
const groupConfig = normalizedId && groups ? groups[normalizedId] : undefined;
const defaultConfig = groups?.["*"];