From db4d0c0abc35d5197329749b343ae2a5b4856873 Mon Sep 17 00:00:00 2001 From: Tak Hoffman <781889+Takhoffman@users.noreply.github.com> Date: Fri, 3 Apr 2026 15:51:49 -0500 Subject: [PATCH] fix: honor mattermost default setup status --- extensions/mattermost/src/setup-surface.ts | 6 +---- extensions/mattermost/src/setup.test.ts | 26 ++++++++++++++++++++++ 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/extensions/mattermost/src/setup-surface.ts b/extensions/mattermost/src/setup-surface.ts index 123871e56ce..fe11f736263 100644 --- a/extensions/mattermost/src/setup-surface.ts +++ b/extensions/mattermost/src/setup-surface.ts @@ -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", diff --git a/extensions/mattermost/src/setup.test.ts b/extensions/mattermost/src/setup.test.ts index 89f49e2a269..bf3f4014f13 100644 --- a/extensions/mattermost/src/setup.test.ts +++ b/extensions/mattermost/src/setup.test.ts @@ -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?.({