fix: honor mattermost default setup status

This commit is contained in:
Tak Hoffman
2026-04-03 15:51:49 -05:00
parent 8e023ffd06
commit db4d0c0abc
2 changed files with 27 additions and 5 deletions

View File

@@ -31,11 +31,7 @@ export const mattermostSetupWizard: ChannelSetupWizard = {
configuredScore: 2,
unconfiguredScore: 1,
resolveConfigured: ({ cfg, accountId }) =>
accountId
? isMattermostConfigured(resolveMattermostAccountWithSecrets(cfg, accountId))
: listMattermostAccountIds(cfg).some((resolvedAccountId) =>
isMattermostConfigured(resolveMattermostAccountWithSecrets(cfg, resolvedAccountId)),
),
isMattermostConfigured(resolveMattermostAccountWithSecrets(cfg, accountId ?? undefined)),
}),
introNote: {
title: "Mattermost bot token",

View File

@@ -257,6 +257,32 @@ describe("mattermost setup", () => {
expect(configured).toBe(true);
});
it("does not inherit configured state from a sibling when defaultAccount is named", async () => {
const configured = await mattermostSetupWizard.status.resolveConfigured({
cfg: {
channels: {
mattermost: {
defaultAccount: "work",
accounts: {
alerts: {
baseUrl: "https://chat.example.com",
botToken: {
source: "env",
provider: "default",
id: "MATTERMOST_BOT_TOKEN",
},
},
work: {},
},
},
},
} as OpenClawConfig,
accountId: undefined,
});
expect(configured).toBe(false);
});
it("shows intro note only when the target account is not configured", () => {
expect(
mattermostSetupWizard.introNote?.shouldShow?.({