Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timeline needs to refresh when we see a MSC2716 marker event #2299

Merged
Show file tree
Hide file tree
Changes from 46 commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
d37fa81
Timeline needs to refresh when we see a MSC2716 marker event
MadLittleMods Apr 14, 2022
dbc7d66
Fix tests failing from function signature changes
MadLittleMods Apr 14, 2022
ee39d6c
Fix argument mismatch
MadLittleMods Apr 14, 2022
2468690
Add missing docstrings
MadLittleMods Apr 14, 2022
f44489d
Raw refreshLiveTimeline function that seems to work
MadLittleMods Apr 16, 2022
1ab5460
Clean up raw commit
MadLittleMods Apr 18, 2022
52ce184
Remove event remitters
MadLittleMods Apr 19, 2022
d7c6802
Merge branch 'develop' into madlittlemods/refresh-timeline-when-we-se…
MadLittleMods Apr 19, 2022
26d4ecd
Fix up lints
MadLittleMods Apr 19, 2022
f1979d2
Fix lints
MadLittleMods Apr 19, 2022
c863ad1
Use UnstableValue
MadLittleMods Apr 19, 2022
b58e198
Clarify toStartOfTimeline order
MadLittleMods Apr 19, 2022
81785ce
Add backwards compatible overloads
MadLittleMods Apr 19, 2022
a98df62
Fix lints
MadLittleMods Apr 19, 2022
a8e4d07
Fix lints
MadLittleMods Apr 19, 2022
d43a994
Match case of other events
MadLittleMods Apr 20, 2022
4acc712
Add some missing type hints
MadLittleMods Apr 20, 2022
15d0e8a
Use built-in matches function
MadLittleMods Apr 20, 2022
64a6e38
Add more missing types
MadLittleMods Apr 20, 2022
46f2933
Merge branch 'develop' into madlittlemods/refresh-timeline-when-we-se…
MadLittleMods May 19, 2022
d267136
Add method to call MSC2716 /batch_send endpoint
MadLittleMods May 20, 2022
148434d
Move batchSend to e2e test in matrix-react-sdk
MadLittleMods May 24, 2022
3973e34
Extra TimelineRefresh to make the timeline blank and have something t…
MadLittleMods May 24, 2022
a086489
getLatestTimeline for when no events exist in the timeline already
MadLittleMods May 25, 2022
d241f13
Some cleanup
MadLittleMods May 25, 2022
0e3a5db
Fix lints
MadLittleMods May 25, 2022
a19b075
Merge branch 'develop' into madlittlemods/refresh-timeline-when-we-se…
MadLittleMods May 25, 2022
3dff724
Better comment
MadLittleMods May 26, 2022
d37f788
Re-register state listeners after `fixUpLegacyTimelineFields` changes…
MadLittleMods May 26, 2022
6b8aa6c
Remove lastMarkerEventProcessed logic
MadLittleMods May 26, 2022
4bb1d14
Add some missing test coverage
MadLittleMods May 26, 2022
34a943b
Add tests for sync state listeners and RoomEvent.CurrentStateUpdated
MadLittleMods May 27, 2022
e412aa1
Fix lint
MadLittleMods May 27, 2022
7a90629
Merge branch 'develop' into madlittlemods/refresh-timeline-when-we-se…
MadLittleMods May 27, 2022
9d1c7c7
Fix test when we only emit on reference change
MadLittleMods May 27, 2022
c36e1b9
Fix test passing with and without timelineSupport
MadLittleMods May 27, 2022
f663d6b
Consolidate imports
MadLittleMods May 27, 2022
313df51
Remove unnecessary overloads for private method
MadLittleMods May 27, 2022
90db6fd
Add barebones tests for overloads
MadLittleMods May 28, 2022
9f3df87
More straight-forward if-else
MadLittleMods May 28, 2022
8fc837f
Added extra explanation what marker event means
MadLittleMods May 28, 2022
78689a9
Fix lint
MadLittleMods May 28, 2022
58fa63c
Dry interfaces by extending (OOP)
MadLittleMods May 28, 2022
d0466a1
Use Pick<> to be more composable and obvious what we're extending
MadLittleMods May 28, 2022
e67b620
Use optional chaining and null coalescing for more accurate and stand…
MadLittleMods May 28, 2022
2a4a430
Add type
MadLittleMods May 28, 2022
e4bd518
Add deprecation warnings for old overloads
MadLittleMods Jun 1, 2022
310423a
Better test name
MadLittleMods Jun 1, 2022
ac07eaf
Add refresh timeline tests to matrix-js-sdk
MadLittleMods Jun 1, 2022
4915aef
WIP: almost working perfect merge test
MadLittleMods Jun 1, 2022
460e887
Working tests
MadLittleMods Jun 1, 2022
741a4fa
Fix lints
MadLittleMods Jun 1, 2022
a33de28
Merge branch 'develop' into madlittlemods/refresh-timeline-when-we-se…
t3chguy Jun 1, 2022
2bda3d3
Accurate return description
MadLittleMods Jun 1, 2022
150a498
Correct function parameters
MadLittleMods Jun 1, 2022
a5f832f
Small formatting updates
MadLittleMods Jun 1, 2022
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
71 changes: 71 additions & 0 deletions spec/integ/matrix-client-event-timeline.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,77 @@ describe("MatrixClient event timelines", function() {
});
});

describe("getLatestTimeline", function() {
it("should create a new timeline for new events", function() {
const room = client.getRoom(roomId);
const timelineSet = room.getTimelineSets()[0];

const latestMessageId = 'event1:bar';

httpBackend.when("GET", "/rooms/!foo%3Abar/messages")
.respond(200, function() {
return {
chunk: [{
event_id: latestMessageId,
}],
};
});

httpBackend.when("GET", `/rooms/!foo%3Abar/context/${encodeURIComponent(latestMessageId)}`)
.respond(200, function() {
return {
start: "start_token",
events_before: [EVENTS[1], EVENTS[0]],
event: EVENTS[2],
events_after: [EVENTS[3]],
state: [
ROOM_NAME_EVENT,
USER_MEMBERSHIP_EVENT,
],
end: "end_token",
};
});

return Promise.all([
client.getLatestTimeline(timelineSet).then(function(tl) {
// Instead of this assertion logic, we could just add a spy
// for `getEventTimeline` and make sure it's called with the
// correct parameters. This doesn't feel to bad to make sure
MadLittleMods marked this conversation as resolved.
Show resolved Hide resolved
// `getLatestTimeline` is doing the right thing though.
expect(tl.getEvents().length).toEqual(4);
for (let i = 0; i < 4; i++) {
expect(tl.getEvents()[i].event).toEqual(EVENTS[i]);
expect(tl.getEvents()[i].sender.name).toEqual(userName);
}
expect(tl.getPaginationToken(EventTimeline.BACKWARDS))
.toEqual("start_token");
expect(tl.getPaginationToken(EventTimeline.FORWARDS))
.toEqual("end_token");
}),
httpBackend.flushAllExpected(),
]);
});

it("should throw error when /messages does not return a message", () => {
const room = client.getRoom(roomId);
const timelineSet = room.getTimelineSets()[0];

httpBackend.when("GET", "/rooms/!foo%3Abar/messages")
.respond(200, () => {
return {
chunk: [
// No messages to return
],
};
});

return Promise.all([
expect(client.getLatestTimeline(timelineSet)).rejects.toThrow(),
httpBackend.flushAllExpected(),
]);
});
});

describe("paginateEventTimeline", function() {
it("should allow you to paginate backwards", function() {
const room = client.getRoom(roomId);
Expand Down
Loading