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
emit self-membership event at end of handling sync update
otherwise the room state isn't updated yet (and we can't for example distinguish a leave from a kick) this is only used for updating the UI, seems safe to emit this event at a later point
This commit is contained in:
10
src/sync.js
10
src/sync.js
@@ -1104,7 +1104,6 @@ SyncApi.prototype._processSyncResponse = async function(
|
||||
const stateEvents =
|
||||
self._mapSyncEventsFormat(inviteObj.invite_state, room);
|
||||
|
||||
room.updateMyMembership("invite");
|
||||
self._processRoomEvents(room, stateEvents);
|
||||
if (inviteObj.isBrandNewRoom) {
|
||||
room.recalculate();
|
||||
@@ -1114,6 +1113,7 @@ SyncApi.prototype._processSyncResponse = async function(
|
||||
stateEvents.forEach(function(e) {
|
||||
client.emit("event", e);
|
||||
});
|
||||
room.updateMyMembership("invite");
|
||||
});
|
||||
|
||||
// Handle joins
|
||||
@@ -1143,8 +1143,6 @@ SyncApi.prototype._processSyncResponse = async function(
|
||||
}
|
||||
}
|
||||
|
||||
room.updateMyMembership("join");
|
||||
|
||||
joinObj.timeline = joinObj.timeline || {};
|
||||
|
||||
if (joinObj.isBrandNewRoom) {
|
||||
@@ -1257,6 +1255,8 @@ SyncApi.prototype._processSyncResponse = async function(
|
||||
accountDataEvents.forEach(function(e) {
|
||||
client.emit("event", e);
|
||||
});
|
||||
|
||||
room.updateMyMembership("join");
|
||||
});
|
||||
|
||||
// Handle leaves (e.g. kicked rooms)
|
||||
@@ -1269,8 +1269,6 @@ SyncApi.prototype._processSyncResponse = async function(
|
||||
const accountDataEvents =
|
||||
self._mapSyncEventsFormat(leaveObj.account_data);
|
||||
|
||||
room.updateMyMembership("leave");
|
||||
|
||||
self._processRoomEvents(room, stateEvents, timelineEvents);
|
||||
room.addAccountData(accountDataEvents);
|
||||
|
||||
@@ -1291,6 +1289,8 @@ SyncApi.prototype._processSyncResponse = async function(
|
||||
accountDataEvents.forEach(function(e) {
|
||||
client.emit("event", e);
|
||||
});
|
||||
|
||||
room.updateMyMembership("leave");
|
||||
});
|
||||
|
||||
// update the notification timeline, if appropriate.
|
||||
|
||||
Reference in New Issue
Block a user