mirror of https://github.com/openclaw/openclaw.git
fix(regression): preserve mattermost reaction channel routing
This commit is contained in:
parent
42ecfffbff
commit
a3961d098a
|
|
@ -3,6 +3,7 @@ import type { OpenClawConfig } from "../../runtime-api.js";
|
|||
import { resolveMattermostAccount } from "./accounts.js";
|
||||
import {
|
||||
evaluateMattermostMentionGate,
|
||||
resolveMattermostReactionChannelId,
|
||||
resolveMattermostEffectiveReplyToId,
|
||||
resolveMattermostReplyRootId,
|
||||
resolveMattermostThreadSessionContext,
|
||||
|
|
@ -274,3 +275,26 @@ describe("resolveMattermostThreadSessionContext", () => {
|
|||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("resolveMattermostReactionChannelId", () => {
|
||||
it("prefers broadcast channel_id when present", () => {
|
||||
expect(
|
||||
resolveMattermostReactionChannelId({
|
||||
broadcast: { channel_id: "chan-broadcast" },
|
||||
data: { channel_id: "chan-data" },
|
||||
}),
|
||||
).toBe("chan-broadcast");
|
||||
});
|
||||
|
||||
it("falls back to data.channel_id when broadcast channel_id is missing", () => {
|
||||
expect(
|
||||
resolveMattermostReactionChannelId({
|
||||
data: { channel_id: "chan-data" },
|
||||
}),
|
||||
).toBe("chan-data");
|
||||
});
|
||||
|
||||
it("returns undefined when neither payload location includes channel_id", () => {
|
||||
expect(resolveMattermostReactionChannelId({})).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -212,6 +212,13 @@ export function resolveMattermostThreadSessionContext(params: {
|
|||
parentSessionKey: threadKeys.parentSessionKey,
|
||||
};
|
||||
}
|
||||
|
||||
export function resolveMattermostReactionChannelId(
|
||||
payload: Pick<MattermostEventPayload, "broadcast" | "data">,
|
||||
): string | undefined {
|
||||
return payload.broadcast?.channel_id?.trim() || payload.data?.channel_id?.trim() || undefined;
|
||||
}
|
||||
|
||||
function buildMattermostAttachmentPlaceholder(mediaList: MattermostMediaInfo[]): string {
|
||||
if (mediaList.length === 0) {
|
||||
return "";
|
||||
|
|
@ -1492,7 +1499,7 @@ export async function monitorMattermostProvider(opts: MonitorMattermostOpts = {}
|
|||
const senderName = senderInfo?.username?.trim() || userId;
|
||||
|
||||
// Resolve the channel from broadcast or post to route to the correct agent session
|
||||
const channelId = payload.broadcast?.channel_id;
|
||||
const channelId = resolveMattermostReactionChannelId(payload);
|
||||
if (!channelId) {
|
||||
// Without a channel id we cannot verify DM/group policies — drop to be safe
|
||||
logVerboseMessage(
|
||||
|
|
|
|||
Loading…
Reference in New Issue