mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 04:50:44 +00:00
fix: honor mattermost default setup status
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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?.({
|
||||
|
||||
Reference in New Issue
Block a user