diff --git a/spec/unit/event-timeline-set.spec.ts b/spec/unit/event-timeline-set.spec.ts index d4b0f621382..ce8fbf32dc4 100644 --- a/spec/unit/event-timeline-set.spec.ts +++ b/spec/unit/event-timeline-set.spec.ts @@ -55,23 +55,6 @@ describe('EventTimelineSet', () => { }); }; - const mkThreadResponse = (root: MatrixEvent) => utils.mkEvent({ - event: true, - type: EventType.RoomMessage, - user: userA, - room: roomId, - content: { - "body": "Thread response :: " + Math.random(), - "m.relates_to": { - "event_id": root.getId(), - "m.in_reply_to": { - "event_id": root.getId(), - }, - "rel_type": "m.thread", - }, - }, - }, room.client); - beforeEach(() => { client = utils.mock(MatrixClient, 'MatrixClient'); client.reEmitter = utils.mock(ReEmitter, 'ReEmitter'); @@ -134,13 +117,6 @@ describe('EventTimelineSet', () => { }); describe('addEventToTimeline', () => { - let thread: Thread; - - beforeEach(() => { - (client.supportsExperimentalThreads as jest.Mock).mockReturnValue(true); - thread = new Thread("!thread_id:server", messageEvent, { room, client }); - }); - it("Adds event to timeline", () => { const liveTimeline = eventTimelineSet.getLiveTimeline(); expect(liveTimeline.getEvents().length).toStrictEqual(0); @@ -168,41 +144,6 @@ describe('EventTimelineSet', () => { ); }).not.toThrow(); }); - - it("should not add an event to a timeline that does not belong to the timelineSet", () => { - const eventTimelineSet2 = new EventTimelineSet(room); - const liveTimeline2 = eventTimelineSet2.getLiveTimeline(); - expect(liveTimeline2.getEvents().length).toStrictEqual(0); - - expect(() => { - eventTimelineSet.addEventToTimeline(messageEvent, liveTimeline2, { - toStartOfTimeline: true, - }); - }).toThrowError(); - }); - - it("should not add a threaded reply to the main room timeline", () => { - const liveTimeline = eventTimelineSet.getLiveTimeline(); - expect(liveTimeline.getEvents().length).toStrictEqual(0); - - const threadedReplyEvent = mkThreadResponse(messageEvent); - - eventTimelineSet.addEventToTimeline(threadedReplyEvent, liveTimeline, { - toStartOfTimeline: true, - }); - expect(liveTimeline.getEvents().length).toStrictEqual(0); - }); - - it("should not add a normal message to the timelineSet representing a thread", () => { - const eventTimelineSetForThread = new EventTimelineSet(room, {}, client, thread); - const liveTimeline = eventTimelineSetForThread.getLiveTimeline(); - expect(liveTimeline.getEvents().length).toStrictEqual(0); - - eventTimelineSetForThread.addEventToTimeline(messageEvent, liveTimeline, { - toStartOfTimeline: true, - }); - expect(liveTimeline.getEvents().length).toStrictEqual(0); - }); }); describe('aggregateRelations', () => { diff --git a/src/models/event-timeline-set.ts b/src/models/event-timeline-set.ts index fd9dc1ff833..e41eec15881 100644 --- a/src/models/event-timeline-set.ts +++ b/src/models/event-timeline-set.ts @@ -702,19 +702,6 @@ export class EventTimelineSet extends TypedEventEmitter { shouldLiveInThread: boolean; threadId?: string; } { - if (!this.client?.supportsExperimentalThreads()) { + if (!this.client.supportsExperimentalThreads()) { return { shouldLiveInRoom: true, shouldLiveInThread: false,