fix: honor mattermost default reply account

This commit is contained in:
Tak Hoffman
2026-04-03 13:34:48 -05:00
parent 323ad51eb8
commit a8302e8eab
2 changed files with 31 additions and 1 deletions

View File

@@ -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", () => {

View File

@@ -437,7 +437,10 @@ export const mattermostPlugin: ChannelPlugin<ResolvedMattermostAccount> = create
threading: {
scopedAccountReplyToMode: {
resolveAccount: (cfg, accountId) =>
resolveMattermostAccount({ cfg, accountId: accountId ?? "default" }),
resolveMattermostAccount({
cfg,
accountId: accountId ?? resolveDefaultMattermostAccountId(cfg),
}),
resolveReplyToMode: (account, chatType) =>
resolveMattermostReplyToMode(
account,