From a8302e8eab214f440e1658dd86bf6b31ccfd1809 Mon Sep 17 00:00:00 2001 From: Tak Hoffman <781889+Takhoffman@users.noreply.github.com> Date: Fri, 3 Apr 2026 13:34:48 -0500 Subject: [PATCH] fix: honor mattermost default reply account --- extensions/mattermost/src/channel.test.ts | 27 +++++++++++++++++++++++ extensions/mattermost/src/channel.ts | 5 ++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/extensions/mattermost/src/channel.test.ts b/extensions/mattermost/src/channel.test.ts index 33eb8f06d7d..9d67f44812a 100644 --- a/extensions/mattermost/src/channel.test.ts +++ b/extensions/mattermost/src/channel.test.ts @@ -175,6 +175,33 @@ describe("mattermostPlugin", () => { }), ).toBe("off"); }); + + it("uses configured defaultAccount when accountId is omitted", () => { + const resolveReplyToMode = requireMattermostReplyToModeResolver(); + + const cfg: OpenClawConfig = { + channels: { + mattermost: { + defaultAccount: "alerts", + replyToMode: "off", + accounts: { + alerts: { + replyToMode: "all", + botToken: "alerts-token", + baseUrl: "https://alerts.example.com", + }, + }, + }, + }, + }; + + expect( + resolveReplyToMode({ + cfg, + chatType: "channel", + }), + ).toBe("all"); + }); }); describe("messageActions", () => { diff --git a/extensions/mattermost/src/channel.ts b/extensions/mattermost/src/channel.ts index ab069401e75..490607a169b 100644 --- a/extensions/mattermost/src/channel.ts +++ b/extensions/mattermost/src/channel.ts @@ -437,7 +437,10 @@ export const mattermostPlugin: ChannelPlugin = create threading: { scopedAccountReplyToMode: { resolveAccount: (cfg, accountId) => - resolveMattermostAccount({ cfg, accountId: accountId ?? "default" }), + resolveMattermostAccount({ + cfg, + accountId: accountId ?? resolveDefaultMattermostAccountId(cfg), + }), resolveReplyToMode: (account, chatType) => resolveMattermostReplyToMode( account,