fix: honor bluebubbles setup dm policy accounts

This commit is contained in:
Tak Hoffman
2026-04-03 10:39:27 -05:00
parent 4b93000d11
commit 625201bddc
3 changed files with 100 additions and 8 deletions

View File

@@ -135,8 +135,21 @@ const dmPolicy: ChannelSetupDmPolicy = {
channel,
policyKey: "channels.bluebubbles.dmPolicy",
allowFromKey: "channels.bluebubbles.allowFrom",
getCurrent: (cfg) => cfg.channels?.bluebubbles?.dmPolicy ?? "pairing",
setPolicy: (cfg, policy) => setBlueBubblesDmPolicy(cfg, policy),
resolveConfigKeys: (_cfg, accountId) =>
accountId && accountId !== DEFAULT_ACCOUNT_ID
? {
policyKey: `channels.bluebubbles.accounts.${accountId}.dmPolicy`,
allowFromKey: `channels.bluebubbles.accounts.${accountId}.allowFrom`,
}
: {
policyKey: "channels.bluebubbles.dmPolicy",
allowFromKey: "channels.bluebubbles.allowFrom",
},
getCurrent: (cfg, accountId) =>
resolveBlueBubblesAccount({ cfg, accountId: accountId ?? DEFAULT_ACCOUNT_ID }).config
.dmPolicy ?? "pairing",
setPolicy: (cfg, policy, accountId) =>
setBlueBubblesDmPolicy(cfg, accountId ?? DEFAULT_ACCOUNT_ID, policy),
promptAllowFrom: promptBlueBubblesAllowFrom,
};