mirror of
https://github.com/moltbot/moltbot.git
synced 2026-03-21 16:41:56 +00:00
fix(mattermost): pass payload.replyToId as root_id for threaded replies (#27744)
Merged via squash.
Prepared head SHA: e029079872
Co-authored-by: hnykda <2741256+hnykda@users.noreply.github.com>
Co-authored-by: mukhtharcm <56378562+mukhtharcm@users.noreply.github.com>
Reviewed-by: @mukhtharcm
This commit is contained in:
@@ -230,6 +230,46 @@ describe("applyReplyThreading auto-threading", () => {
|
||||
expect(result[0].replyToId).toBe("42");
|
||||
expect(result[0].replyToTag).toBe(true);
|
||||
});
|
||||
|
||||
it("resolves [[reply_to_current]] to currentMessageId when replyToMode is 'all'", () => {
|
||||
// Mattermost-style scenario: agent responds with [[reply_to_current]] and replyToMode
|
||||
// is "all". The tag should resolve to the inbound message id.
|
||||
const result = applyReplyThreading({
|
||||
payloads: [{ text: "[[reply_to_current]] some reply text" }],
|
||||
replyToMode: "all",
|
||||
currentMessageId: "mm-post-abc123",
|
||||
});
|
||||
|
||||
expect(result).toHaveLength(1);
|
||||
expect(result[0].replyToId).toBe("mm-post-abc123");
|
||||
expect(result[0].replyToTag).toBe(true);
|
||||
expect(result[0].text).toBe("some reply text");
|
||||
});
|
||||
|
||||
it("resolves [[reply_to:<id>]] to explicit id when replyToMode is 'all'", () => {
|
||||
const result = applyReplyThreading({
|
||||
payloads: [{ text: "[[reply_to:mm-post-xyz789]] threaded reply" }],
|
||||
replyToMode: "all",
|
||||
currentMessageId: "mm-post-abc123",
|
||||
});
|
||||
|
||||
expect(result).toHaveLength(1);
|
||||
expect(result[0].replyToId).toBe("mm-post-xyz789");
|
||||
expect(result[0].text).toBe("threaded reply");
|
||||
});
|
||||
|
||||
it("sets replyToId via implicit threading when replyToMode is 'all'", () => {
|
||||
// Even without explicit tags, replyToMode "all" should set replyToId
|
||||
// to currentMessageId for threading.
|
||||
const result = applyReplyThreading({
|
||||
payloads: [{ text: "hello" }],
|
||||
replyToMode: "all",
|
||||
currentMessageId: "mm-post-abc123",
|
||||
});
|
||||
|
||||
expect(result).toHaveLength(1);
|
||||
expect(result[0].replyToId).toBe("mm-post-abc123");
|
||||
});
|
||||
});
|
||||
|
||||
const baseRun: SubagentRunRecord = {
|
||||
|
||||
Reference in New Issue
Block a user