You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-26 17:03:12 +03:00
track kicked rooms correctly
This commit is contained in:
20
lib/sync.js
20
lib/sync.js
@@ -719,14 +719,28 @@ SyncApi.prototype._processSyncResponse = function(syncToken, data) {
|
|||||||
accountDataEvents.forEach(function(e) { client.emit("event", e); });
|
accountDataEvents.forEach(function(e) { client.emit("event", e); });
|
||||||
});
|
});
|
||||||
|
|
||||||
// Handle leaves
|
// Handle leaves (e.g. kicked rooms)
|
||||||
leaveRooms.forEach(function(leaveObj) {
|
leaveRooms.forEach(function(leaveObj) {
|
||||||
// Do the bear minimum to register rejected invites / you leaving rooms
|
|
||||||
var room = leaveObj.room;
|
var room = leaveObj.room;
|
||||||
|
var stateEvents =
|
||||||
|
self._mapSyncEventsFormat(leaveObj.state, room);
|
||||||
var timelineEvents =
|
var timelineEvents =
|
||||||
self._mapSyncEventsFormat(leaveObj.timeline, room);
|
self._mapSyncEventsFormat(leaveObj.timeline, room);
|
||||||
room.addEvents(timelineEvents);
|
var accountDataEvents =
|
||||||
|
self._mapSyncEventsFormat(leaveObj.account_data);
|
||||||
|
|
||||||
|
self._processRoomEvents(room, stateEvents, timelineEvents);
|
||||||
|
room.addAccountData(accountDataEvents);
|
||||||
|
|
||||||
|
room.recalculate(client.credentials.userId);
|
||||||
|
if (leaveObj.isBrandNewRoom) {
|
||||||
|
client.store.storeRoom(room);
|
||||||
|
client.emit("Room", room);
|
||||||
|
}
|
||||||
|
|
||||||
|
stateEvents.forEach(function(e) { client.emit("event", e); });
|
||||||
timelineEvents.forEach(function(e) { client.emit("event", e); });
|
timelineEvents.forEach(function(e) { client.emit("event", e); });
|
||||||
|
accountDataEvents.forEach(function(e) { client.emit("event", e); });
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user