From 013f30294af8c4195315c2ea539c29ef6168660b Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 13 Apr 2022 12:54:27 +0100 Subject: [PATCH 1/2] Stop tracking threads if threads support is disabled --- src/client.ts | 6 ++++-- src/models/room.ts | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/client.ts b/src/client.ts index bc55145e557..a601c96de24 100644 --- a/src/client.ts +++ b/src/client.ts @@ -3776,7 +3776,6 @@ export class MatrixClient extends TypedEventEmitter public threadsReady = false; public async fetchRoomThreads(): Promise { - if (this.threadsReady) { + if (this.threadsReady || !this.client.supportsExperimentalThreads()) { return; } @@ -1662,7 +1662,7 @@ export class Room extends TypedEventEmitter // benefit from all the APIs a homeserver can provide to enhance the thread experience thread = this.createThread(rootEvent, events, toStartOfTimeline); if (thread) { - rootEvent.setThread(thread); + rootEvent?.setThread(thread); } deferred.resolve(thread); } From 3903bc8e89c69098f40a2eb8f0ad4e3509056bad Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 13 Apr 2022 13:02:51 +0100 Subject: [PATCH 2/2] Fix tests by enabling threads support for the threads test --- spec/integ/matrix-client-event-timeline.spec.js | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/integ/matrix-client-event-timeline.spec.js b/spec/integ/matrix-client-event-timeline.spec.js index ad475f3fc5a..6e93a063a8d 100644 --- a/spec/integ/matrix-client-event-timeline.spec.js +++ b/spec/integ/matrix-client-event-timeline.spec.js @@ -496,6 +496,7 @@ describe("MatrixClient event timelines", function() { }); it("should handle thread replies with server support by fetching a contiguous thread timeline", async () => { + client.clientOpts.experimentalThreadSupport = true; Thread.setServerSideSupport(true); client.stopClient(); // we don't need the client to be syncing at this time const room = client.getRoom(roomId);