You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-28 05:03:59 +03:00
Merge pull request #61 from matrix-org/matthew/accountdata
implement account data
This commit is contained in:
18
lib/sync.js
18
lib/sync.js
@@ -139,7 +139,8 @@ SyncApi.prototype.syncLeftRooms = function() {
|
||||
return;
|
||||
}
|
||||
leaveObj.timeline = leaveObj.timeline || {};
|
||||
var timelineEvents = self._mapSyncEventsFormat(leaveObj.timeline, room);
|
||||
var timelineEvents =
|
||||
self._mapSyncEventsFormat(leaveObj.timeline, room);
|
||||
var stateEvents = self._mapSyncEventsFormat(leaveObj.state, room);
|
||||
var paginationToken = (
|
||||
leaveObj.timeline.limited ? leaveObj.timeline.prev_batch : null
|
||||
@@ -420,7 +421,8 @@ SyncApi.prototype._sync = function(syncOptions, attempt) {
|
||||
// Handle invites
|
||||
inviteRooms.forEach(function(inviteObj) {
|
||||
var room = inviteObj.room;
|
||||
var stateEvents = self._mapSyncEventsFormat(inviteObj.invite_state, room);
|
||||
var stateEvents =
|
||||
self._mapSyncEventsFormat(inviteObj.invite_state, room);
|
||||
self._processRoomEvents(room, stateEvents);
|
||||
if (inviteObj.isBrandNewRoom) {
|
||||
room.recalculate(client.credentials.userId);
|
||||
@@ -458,8 +460,15 @@ SyncApi.prototype._sync = function(syncOptions, attempt) {
|
||||
self._processRoomEvents(
|
||||
room, stateEvents, timelineEvents, paginationToken
|
||||
);
|
||||
|
||||
// XXX: should we be adding ephemeralEvents to the timeline?
|
||||
// It feels like that for symmetry with room.addAccountData()
|
||||
// there should be a room.addEphemeralEvents() or similar.
|
||||
room.addEvents(ephemeralEvents);
|
||||
room.addEvents(accountDataEvents);
|
||||
|
||||
// we deliberately don't add accountData to the timeline
|
||||
room.addAccountData(accountDataEvents);
|
||||
|
||||
room.recalculate(client.credentials.userId);
|
||||
if (joinObj.isBrandNewRoom) {
|
||||
client.store.storeRoom(room);
|
||||
@@ -475,7 +484,8 @@ SyncApi.prototype._sync = function(syncOptions, attempt) {
|
||||
leaveRooms.forEach(function(leaveObj) {
|
||||
// Do the bear minimum to register rejected invites / you leaving rooms
|
||||
var room = leaveObj.room;
|
||||
var timelineEvents = self._mapSyncEventsFormat(leaveObj.timeline, room);
|
||||
var timelineEvents =
|
||||
self._mapSyncEventsFormat(leaveObj.timeline, room);
|
||||
room.addEvents(timelineEvents);
|
||||
timelineEvents.forEach(function(e) { client.emit("event", e); });
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user