feat(matrix): thread-isolated sessions and per-chat-type threadReplies (#57995)
Merged via squash. Prepared head SHA: 9ed96dd0632e4b689f83c590943c82c9dc93f2c8 Co-authored-by: teconomix <6959299+teconomix@users.noreply.github.com> Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Reviewed-by: @gumadeirasfeature/PAZ-358-fe-credit-error-display
parent
d859746862
commit
697dddbeb6
@ -0,0 +1,68 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { resolveMatrixThreadRouting } from "./threads.js";
|
||||
|
||||
describe("resolveMatrixThreadRouting", () => {
|
||||
it("keeps sessions flat when threadReplies is off", () => {
|
||||
expect(
|
||||
resolveMatrixThreadRouting({
|
||||
isDirectMessage: false,
|
||||
threadReplies: "off",
|
||||
messageId: "$reply1",
|
||||
threadRootId: "$root",
|
||||
}),
|
||||
).toEqual({
|
||||
threadId: undefined,
|
||||
});
|
||||
});
|
||||
|
||||
it("uses the inbound thread root when replies arrive inside an existing thread", () => {
|
||||
expect(
|
||||
resolveMatrixThreadRouting({
|
||||
isDirectMessage: false,
|
||||
threadReplies: "inbound",
|
||||
messageId: "$reply1",
|
||||
threadRootId: "$root",
|
||||
}),
|
||||
).toEqual({
|
||||
threadId: "$root",
|
||||
});
|
||||
});
|
||||
|
||||
it("keeps top-level inbound messages flat when threadReplies is inbound", () => {
|
||||
expect(
|
||||
resolveMatrixThreadRouting({
|
||||
isDirectMessage: false,
|
||||
threadReplies: "inbound",
|
||||
messageId: "$root",
|
||||
}),
|
||||
).toEqual({
|
||||
threadId: undefined,
|
||||
});
|
||||
});
|
||||
|
||||
it("uses the triggering message as the thread id when threadReplies is always", () => {
|
||||
expect(
|
||||
resolveMatrixThreadRouting({
|
||||
isDirectMessage: false,
|
||||
threadReplies: "always",
|
||||
messageId: "$root",
|
||||
}),
|
||||
).toEqual({
|
||||
threadId: "$root",
|
||||
});
|
||||
});
|
||||
|
||||
it("lets dm.threadReplies override room threading behavior", () => {
|
||||
expect(
|
||||
resolveMatrixThreadRouting({
|
||||
isDirectMessage: true,
|
||||
threadReplies: "always",
|
||||
dmThreadReplies: "off",
|
||||
messageId: "$reply1",
|
||||
threadRootId: "$root",
|
||||
}),
|
||||
).toEqual({
|
||||
threadId: undefined,
|
||||
});
|
||||
});
|
||||
});
|
||||
Loading…
Reference in New Issue