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
Next Next commit
Merge branch 'develop' into madlittlemods/refresh-timeline-when-we-see-
…msc2716-marker-events-v2

Conflicts:
	spec/integ/matrix-client-event-timeline.spec.ts
	src/client.ts
  • Loading branch information
MadLittleMods committed Oct 14, 2022
commit b97de19757336e8190d8e17a0192d649d0b054f1
29 changes: 21 additions & 8 deletions spec/integ/matrix-client-event-timeline.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -693,8 +693,8 @@ describe("MatrixClient event timelines", function() {

// getEventTimeline -> thread.fetchInitialEvents
httpBackend.when("GET", "/rooms/!foo%3Abar/relations/" +
encodeURIComponent(THREAD_ROOT.event_id) + "/" +
encodeURIComponent(THREAD_RELATION_TYPE.name) + "?limit=20&direction=b")
encodeURIComponent(THREAD_ROOT.event_id!) + "/" +
encodeURIComponent(THREAD_RELATION_TYPE.name) + "?limit=20&dir=b")
.respond(200, function() {
return {
original_event: THREAD_ROOT,
Expand All @@ -705,8 +705,8 @@ describe("MatrixClient event timelines", function() {

// getEventTimeline -> thread.fetchEvents
httpBackend.when("GET", "/rooms/!foo%3Abar/relations/" +
encodeURIComponent(THREAD_ROOT.event_id) + "/" +
encodeURIComponent(THREAD_RELATION_TYPE.name) + "?direction=b&limit=50")
encodeURIComponent(THREAD_ROOT.event_id!) + "/" +
encodeURIComponent(THREAD_RELATION_TYPE.name) + "?dir=b&limit=50")
.respond(200, function() {
return {
original_event: THREAD_ROOT,
Expand All @@ -715,13 +715,13 @@ describe("MatrixClient event timelines", function() {
};
});

const timelinePromise = client.getEventTimeline(timelineSet, EVENTS[0].event_id);
const timelinePromise = client.getEventTimeline(timelineSet, EVENTS[0].event_id!);
await httpBackend.flushAllExpected();

const timeline = await timelinePromise;

// The main timeline event should not be in the timelineSet representing a thread
expect(timeline.getEvents().find(e => e.getId() === EVENTS[0].event_id)).toBeFalsy();
expect(timeline.getEvents().find(e => e.getId() === EVENTS[0].event_id!)).toBeFalsy();
});

it("should not include threaded reply when timelineSet is representing the main room", async () => {
Expand Down Expand Up @@ -750,7 +750,7 @@ describe("MatrixClient event timelines", function() {
const timeline = await timelinePromise;

// The threaded reply should not be in a main room timeline
expect(timeline.getEvents().find(e => e.getId() === THREAD_REPLY.event_id)).toBeFalsy();
expect(timeline.getEvents().find(e => e.getId() === THREAD_REPLY.event_id!)).toBeFalsy();
});

it("should should add lazy loading filter when requested", async () => {
Expand Down Expand Up @@ -788,7 +788,20 @@ describe("MatrixClient event timelines", function() {
client.clientOpts.experimentalThreadSupport = true;
});

it("should create a new timeline for new events", function() {
it("timeline support must be enabled to work", async function() {
await client.stopClient();

const testClient = new TestClient(
userId,
"DEVICE",
accessToken,
undefined,
{ timelineSupport: false },
);
client = testClient.client;
httpBackend = testClient.httpBackend;
await startClient(httpBackend, client);

const room = client.getRoom(roomId);
const timelineSet = room.getTimelineSets()[0];
await expect(client.getLatestTimeline(timelineSet)).rejects.toBeTruthy();
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
You are viewing a condensed version of this merge commit. You can view the full changes here.