Don't form continuations from thread roots (#8166)
* Don't form continuations from thread roots * Only apply the continuation break in the main timeline
This commit is contained in:
parent
6c69f3e3b6
commit
1e060fed84
5 changed files with 62 additions and 11 deletions
|
@ -25,6 +25,7 @@ import * as TestUtils from "react-dom/test-utils";
|
|||
|
||||
import { MatrixClientPeg } from '../../../src/MatrixClientPeg';
|
||||
import sdk from '../../skinned-sdk';
|
||||
import MessagePanel, { shouldFormContinuation } from "../../../src/components/structures/MessagePanel";
|
||||
import SettingsStore from "../../../src/settings/SettingsStore";
|
||||
import MatrixClientContext from "../../../src/contexts/MatrixClientContext";
|
||||
import RoomContext from "../../../src/contexts/RoomContext";
|
||||
|
@ -32,8 +33,6 @@ import DMRoomMap from "../../../src/utils/DMRoomMap";
|
|||
import { UnwrappedEventTile } from "../../../src/components/views/rooms/EventTile";
|
||||
import * as TestUtilsMatrix from "../../test-utils";
|
||||
|
||||
const MessagePanel = sdk.getComponent('structures.MessagePanel');
|
||||
|
||||
let client;
|
||||
const room = new Matrix.Room("!roomId:server_name");
|
||||
|
||||
|
@ -594,3 +593,25 @@ describe('MessagePanel', function() {
|
|||
expect(els.last().prop("events").length).toEqual(5);
|
||||
});
|
||||
});
|
||||
|
||||
describe("shouldFormContinuation", () => {
|
||||
it("does not form continuations from thread roots", () => {
|
||||
const threadRoot = TestUtilsMatrix.mkMessage({
|
||||
event: true,
|
||||
room: "!room:id",
|
||||
user: "@user:id",
|
||||
msg: "Here is a thread",
|
||||
});
|
||||
jest.spyOn(threadRoot, "isThreadRoot", "get").mockReturnValue(true);
|
||||
|
||||
const message = TestUtilsMatrix.mkMessage({
|
||||
event: true,
|
||||
room: "!room:id",
|
||||
user: "@user:id",
|
||||
msg: "And here's another message in the main timeline",
|
||||
});
|
||||
|
||||
expect(shouldFormContinuation(threadRoot, message, false, true)).toEqual(false);
|
||||
expect(shouldFormContinuation(message, threadRoot, false, true)).toEqual(true);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue