Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix some lints
  • Loading branch information
MadLittleMods committed Oct 14, 2022
commit f82ea0cb5990f8435a772b508e131775e59da0ae
12 changes: 6 additions & 6 deletions spec/integ/matrix-client-event-timeline.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,7 @@ describe("MatrixClient event timelines", function() {
};
});

const timelinePromise = client.getEventTimeline(timelineSet, THREAD_REPLY.event_id);
const timelinePromise = client.getEventTimeline(timelineSet, THREAD_REPLY.event_id!);
await httpBackend.flushAllExpected();

const timeline = await timelinePromise;
Expand Down Expand Up @@ -803,7 +803,7 @@ describe("MatrixClient event timelines", function() {
await startClient(httpBackend, client);

const room = client.getRoom(roomId);
const timelineSet = room.getTimelineSets()[0];
const timelineSet = room!.getTimelineSets()[0];
await expect(client.getLatestTimeline(timelineSet)).rejects.toBeTruthy();
});

Expand Down Expand Up @@ -897,7 +897,7 @@ describe("MatrixClient event timelines", function() {

it("should successfully create a new timeline even when the latest event is a threaded reply", function() {
const room = client.getRoom(roomId);
const timelineSet = room.getTimelineSets()[0];
const timelineSet = room!.getTimelineSets()[0];
expect(timelineSet.thread).toBeUndefined();

const latestMessageId = 'threadedEvent1:bar';
Expand Down Expand Up @@ -937,16 +937,16 @@ describe("MatrixClient event timelines", function() {
};
return Promise.all([
client.getLatestTimeline(timelineSet).then(function(tl) {
const events = tl.getEvents();
const events = tl!.getEvents();
const expectedEvents = [EVENTS[0], THREAD_ROOT];
expect(events.map(event => eventPropertiesToCompare(event)))
.toEqual(expectedEvents.map(event => eventPropertiesToCompare(event)));
// Sanity check: The threaded reply should not be in the timeline
expect(events.find(e => e.getId() === THREAD_REPLY.event_id)).toBeFalsy();

expect(tl.getPaginationToken(EventTimeline.BACKWARDS))
expect(tl!.getPaginationToken(EventTimeline.BACKWARDS))
.toEqual("start_token");
expect(tl.getPaginationToken(EventTimeline.FORWARDS))
expect(tl!.getPaginationToken(EventTimeline.FORWARDS))
.toEqual("end_token");
}),
httpBackend.flushAllExpected(),
Expand Down
4 changes: 2 additions & 2 deletions spec/unit/event-timeline-set.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,8 @@ describe('EventTimelineSet', () => {
});

it('should not return the related events', () => {
eventTimelineSet.relations.aggregateChildEvent(messageEvent);
const relations = eventTimelineSet.relations.getChildEventsForEvent(
eventTimelineSet!.relations.aggregateChildEvent(messageEvent);
const relations = eventTimelineSet!.relations.getChildEventsForEvent(
messageEvent.getId(),
"m.in_reply_to",
EventType.RoomMessage,
Expand Down
2 changes: 1 addition & 1 deletion src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5208,7 +5208,7 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
event,
...res.events_before.map(mapper),
];

if (this.supportsExperimentalThreads()) {
// Where the event is a thread reply (not a root) and running in MSC-enabled mode the Thread timeline only
// functions contiguously, so we have to jump through some hoops to get our target event in it.
Expand Down