mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 15:30:47 +00:00
Twitch: fix setup DM config hints
This commit is contained in:
@@ -315,6 +315,31 @@ describe("setup surface helpers", () => {
|
||||
});
|
||||
|
||||
describe("setup wizard account routing", () => {
|
||||
it("reports account-scoped DM policy config keys", () => {
|
||||
expect(
|
||||
twitchSetupWizard.dmPolicy?.resolveConfigKeys?.(
|
||||
{
|
||||
channels: {
|
||||
twitch: {
|
||||
defaultAccount: "secondary",
|
||||
},
|
||||
},
|
||||
} as Parameters<
|
||||
NonNullable<NonNullable<typeof twitchSetupWizard.dmPolicy>["resolveConfigKeys"]>
|
||||
>[0],
|
||||
undefined,
|
||||
),
|
||||
).toEqual({
|
||||
policyKey: "channels.twitch.accounts.secondary.allowedRoles",
|
||||
allowFromKey: "channels.twitch.accounts.secondary.allowFrom",
|
||||
});
|
||||
|
||||
expect(twitchSetupWizard.dmPolicy?.resolveConfigKeys?.({} as never, "alerts")).toEqual({
|
||||
policyKey: "channels.twitch.accounts.alerts.allowedRoles",
|
||||
allowFromKey: "channels.twitch.accounts.alerts.allowFrom",
|
||||
});
|
||||
});
|
||||
|
||||
it("writes to the requested account when defaultAccount is not created yet", async () => {
|
||||
mockPromptText
|
||||
.mockReset()
|
||||
|
||||
@@ -285,8 +285,15 @@ function setTwitchGroupPolicy(
|
||||
const twitchDmPolicy: ChannelSetupDmPolicy = {
|
||||
label: "Twitch",
|
||||
channel,
|
||||
policyKey: "channels.twitch.allowedRoles",
|
||||
allowFromKey: "channels.twitch.accounts.<default>.allowFrom",
|
||||
policyKey: "channels.twitch.accounts.default.allowedRoles",
|
||||
allowFromKey: "channels.twitch.accounts.default.allowFrom",
|
||||
resolveConfigKeys: (cfg, accountId) => {
|
||||
const resolvedAccountId = resolveSetupAccountId(cfg, accountId);
|
||||
return {
|
||||
policyKey: `channels.twitch.accounts.${resolvedAccountId}.allowedRoles`,
|
||||
allowFromKey: `channels.twitch.accounts.${resolvedAccountId}.allowFrom`,
|
||||
};
|
||||
},
|
||||
getCurrent: (cfg, accountId) => {
|
||||
const account = getAccountConfig(cfg, resolveSetupAccountId(cfg, accountId));
|
||||
if (account?.allowedRoles?.includes("all")) {
|
||||
|
||||
Reference in New Issue
Block a user