mirror of https://github.com/openclaw/openclaw.git
fix(mattermost): honor replyToMode off for threaded messages
This commit is contained in:
parent
55e0c6380a
commit
aaba1ae653
|
|
@ -169,6 +169,17 @@ describe("resolveMattermostEffectiveReplyToId", () => {
|
|||
).toBe("thread-root-456");
|
||||
});
|
||||
|
||||
it("suppresses existing thread roots when replyToMode is off", () => {
|
||||
expect(
|
||||
resolveMattermostEffectiveReplyToId({
|
||||
kind: "channel",
|
||||
postId: "post-123",
|
||||
replyToMode: "off",
|
||||
threadRootId: "thread-root-456",
|
||||
}),
|
||||
).toBeUndefined();
|
||||
});
|
||||
|
||||
it("starts a thread for top-level channel messages when replyToMode is all", () => {
|
||||
expect(
|
||||
resolveMattermostEffectiveReplyToId({
|
||||
|
|
@ -232,6 +243,22 @@ describe("resolveMattermostThreadSessionContext", () => {
|
|||
});
|
||||
});
|
||||
|
||||
it("keeps threaded messages top-level when replyToMode is off", () => {
|
||||
expect(
|
||||
resolveMattermostThreadSessionContext({
|
||||
baseSessionKey: "agent:main:mattermost:default:chan-1",
|
||||
kind: "group",
|
||||
postId: "post-123",
|
||||
replyToMode: "off",
|
||||
threadRootId: "root-456",
|
||||
}),
|
||||
).toEqual({
|
||||
effectiveReplyToId: undefined,
|
||||
sessionKey: "agent:main:mattermost:default:chan-1",
|
||||
parentSessionKey: undefined,
|
||||
});
|
||||
});
|
||||
|
||||
it("keeps direct-message sessions linear", () => {
|
||||
expect(
|
||||
resolveMattermostThreadSessionContext({
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ export function resolveMattermostEffectiveReplyToId(params: {
|
|||
threadRootId?: string | null;
|
||||
}): string | undefined {
|
||||
const threadRootId = params.threadRootId?.trim();
|
||||
if (threadRootId) {
|
||||
if (threadRootId && params.replyToMode !== "off") {
|
||||
return threadRootId;
|
||||
}
|
||||
if (params.kind === "direct") {
|
||||
|
|
|
|||
Loading…
Reference in New Issue