You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-07-30 02:21:17 +03:00
Don't form continuations on either side of a thread root (#8408)
This commit is contained in:
committed by
GitHub
parent
f85e178fc1
commit
a70f11704f
@ -674,6 +674,20 @@ describe('MessagePanel', function() {
|
||||
|
||||
describe("shouldFormContinuation", () => {
|
||||
it("does not form continuations from thread roots", () => {
|
||||
const message1 = TestUtilsMatrix.mkMessage({
|
||||
event: true,
|
||||
room: "!room:id",
|
||||
user: "@user:id",
|
||||
msg: "Here is a message in the main timeline",
|
||||
});
|
||||
|
||||
const message2 = TestUtilsMatrix.mkMessage({
|
||||
event: true,
|
||||
room: "!room:id",
|
||||
user: "@user:id",
|
||||
msg: "And here's another message in the main timeline",
|
||||
});
|
||||
|
||||
const threadRoot = TestUtilsMatrix.mkMessage({
|
||||
event: true,
|
||||
room: "!room:id",
|
||||
@ -682,14 +696,15 @@ describe("shouldFormContinuation", () => {
|
||||
});
|
||||
jest.spyOn(threadRoot, "isThreadRoot", "get").mockReturnValue(true);
|
||||
|
||||
const message = TestUtilsMatrix.mkMessage({
|
||||
const message3 = TestUtilsMatrix.mkMessage({
|
||||
event: true,
|
||||
room: "!room:id",
|
||||
user: "@user:id",
|
||||
msg: "And here's another message in the main timeline",
|
||||
msg: "And here's another message in the main timeline after the thread root",
|
||||
});
|
||||
|
||||
expect(shouldFormContinuation(threadRoot, message, false, true)).toEqual(false);
|
||||
expect(shouldFormContinuation(message, threadRoot, false, true)).toEqual(true);
|
||||
expect(shouldFormContinuation(message1, message2, false, true)).toEqual(true);
|
||||
expect(shouldFormContinuation(message2, threadRoot, false, true)).toEqual(false);
|
||||
expect(shouldFormContinuation(threadRoot, message3, false, true)).toEqual(false);
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user