Don't consider threads for breaking continuation until actually created (#8581)

* Don't consider threads for breaking continuation until they've actually been created

* Update tests

* Make hasThreadSummary null thread safe

* Apply feedback from pr review
This commit is contained in:
Michael Telatynski 2022-05-13 12:59:50 +01:00 committed by GitHub
parent fbbb9c27ba
commit 59b9d1e818
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 2 deletions

View file

@ -699,7 +699,7 @@ describe('MessagePanel', function() {
});
describe("shouldFormContinuation", () => {
it("does not form continuations from thread roots", () => {
it("does not form continuations from thread roots which have summaries", () => {
const message1 = TestUtilsMatrix.mkMessage({
event: true,
room: "!room:id",
@ -730,6 +730,14 @@ describe("shouldFormContinuation", () => {
});
expect(shouldFormContinuation(message1, message2, false, true)).toEqual(true);
expect(shouldFormContinuation(message2, threadRoot, false, true)).toEqual(true);
expect(shouldFormContinuation(threadRoot, message3, false, true)).toEqual(true);
const thread = {
length: 1,
replyToEvent: {},
};
jest.spyOn(threadRoot, "getThread").mockReturnValue(thread);
expect(shouldFormContinuation(message2, threadRoot, false, true)).toEqual(false);
expect(shouldFormContinuation(threadRoot, message3, false, true)).toEqual(false);
});