1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-28 05:03:59 +03:00

move userId into room

This commit is contained in:
Bruno Windels
2018-08-02 11:10:04 +02:00
parent b034f67a0f
commit c0f706a2a2
4 changed files with 71 additions and 57 deletions

View File

@@ -113,7 +113,7 @@ function SyncApi(client, opts) {
*/
SyncApi.prototype.createRoom = function(roomId) {
const client = this.client;
const room = new Room(roomId, {
const room = new Room(roomId, client.getUserId(), {
pendingEventOrdering: this.opts.pendingEventOrdering,
timelineSupport: client.timelineSupport,
});
@@ -232,7 +232,7 @@ SyncApi.prototype.syncLeftRooms = function() {
self._processRoomEvents(room, stateEvents, timelineEvents);
room.recalculate(client.credentials.userId);
room.recalculate();
client.store.storeRoom(room);
client.emit("Room", room);
@@ -303,7 +303,7 @@ SyncApi.prototype.peek = function(roomId) {
peekRoom.currentState.setStateEvents(stateEvents);
self._resolveInvites(peekRoom);
peekRoom.recalculate(self.client.credentials.userId);
peekRoom.recalculate();
// roll backwards to diverge old state. addEventsToTimeline
// will overwrite the pagination token, so make sure it overwrites
@@ -969,7 +969,7 @@ SyncApi.prototype._processSyncResponse = async function(
self._mapSyncEventsFormat(inviteObj.invite_state, room);
self._processRoomEvents(room, stateEvents);
if (inviteObj.isBrandNewRoom) {
room.recalculate(client.credentials.userId);
room.recalculate();
client.store.storeRoom(room);
client.emit("Room", room);
}
@@ -1076,7 +1076,7 @@ SyncApi.prototype._processSyncResponse = async function(
// we deliberately don't add accountData to the timeline
room.addAccountData(accountDataEvents);
room.recalculate(client.credentials.userId);
room.recalculate();
if (joinObj.isBrandNewRoom) {
client.store.storeRoom(room);
client.emit("Room", room);
@@ -1116,7 +1116,7 @@ SyncApi.prototype._processSyncResponse = async function(
self._processRoomEvents(room, stateEvents, timelineEvents);
room.addAccountData(accountDataEvents);
room.recalculate(client.credentials.userId);
room.recalculate();
if (leaveObj.isBrandNewRoom) {
client.store.storeRoom(room);
client.emit("Room", room);
@@ -1406,7 +1406,7 @@ SyncApi.prototype._processRoomEvents = function(room, stateEventList,
// a recalculation (like m.room.name) we won't recalculate until we've
// finished adding all the events, which will cause the notification to have
// the old room name rather than the new one.
room.recalculate(this.client.credentials.userId);
room.recalculate();
// If the timeline wasn't empty, we process the state events here: they're
// defined as updates to the state before the start of the timeline, so this