1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2026-01-03 23:22:30 +03:00

Refactor the addition of events to rooms

... and add some sanity checks

Two things here:

1. Clean up the Room API for adding new events to the timeline. Where before
we had addEvents and addEventsToTimeline, whose purposes were unclear, we now
have addLiveEvents which must be used for adding events to the end of the live
timeline, and addEventsToTimeline which should be used for pagination (either
back-pagination of the live timeline, or pagination of an old timeline).

2. Add some sanity checks for the live timeline. Today we have seen problems
where somehow the live timeline had gained a forward pagination token, or the
live timeline had got joined to another timeline, leading to much confusion -
and I would like to notice these sooner.
This commit is contained in:
Richard van der Hoff
2016-04-14 17:03:25 +01:00
parent 90101c0340
commit d87e5471fa
6 changed files with 290 additions and 265 deletions

View File

@@ -34,7 +34,7 @@ describe("MatrixClient", function() {
it("should no-op if you've already joined a room", function() {
var roomId = "!foo:bar";
var room = new Room(roomId);
room.addEvents([
room.addLiveEvents([
utils.mkMembership({
user: userId, room: roomId, mship: "join", event: true
})