refactor: share config adapter allowFrom and defaultTo helpers

This commit is contained in:
Peter Steinberger
2026-03-07 23:02:59 +00:00
parent feac26c3b7
commit 556aa8a702
17 changed files with 100 additions and 57 deletions

View File

@@ -2,6 +2,7 @@ import {
buildAccountScopedDmSecurityPolicy,
collectOpenGroupPolicyRestrictSendersWarnings,
formatNormalizedAllowFromEntries,
mapAllowFromEntries,
} from "openclaw/plugin-sdk";
import {
applyAccountNameToChannelSection,
@@ -276,9 +277,7 @@ export const mattermostPlugin: ChannelPlugin<ResolvedMattermostAccount> = {
baseUrl: account.baseUrl,
}),
resolveAllowFrom: ({ cfg, accountId }) =>
(resolveMattermostAccount({ cfg, accountId }).config.allowFrom ?? []).map((entry) =>
String(entry),
),
mapAllowFromEntries(resolveMattermostAccount({ cfg, accountId }).config.allowFrom),
formatAllowFrom: ({ allowFrom }) =>
formatNormalizedAllowFromEntries({
allowFrom,