emit events for rooms before invites
so the room is already there when removing the invite
This commit is contained in:
parent
b77d0f75ce
commit
b9f145caa4
1 changed files with 7 additions and 6 deletions
|
@ -287,18 +287,19 @@ export class Sync {
|
||||||
|
|
||||||
_afterSync(sessionState, inviteStates, roomStates, log) {
|
_afterSync(sessionState, inviteStates, roomStates, log) {
|
||||||
log.wrap("session", log => this._session.afterSync(sessionState.changes, log), log.level.Detail);
|
log.wrap("session", log => this._session.afterSync(sessionState.changes, log), log.level.Detail);
|
||||||
|
// emit room related events after txn has been closed
|
||||||
|
for(let rs of roomStates) {
|
||||||
|
log.wrap("room", log => rs.room.afterSync(rs.changes, log), log.level.Detail);
|
||||||
|
if (rs.isNewRoom) {
|
||||||
|
this._session.addRoomAfterSync(rs.room);
|
||||||
|
}
|
||||||
|
}
|
||||||
// emit invite related events after txn has been closed
|
// emit invite related events after txn has been closed
|
||||||
for(let is of inviteStates) {
|
for(let is of inviteStates) {
|
||||||
log.wrap("invite", () => is.invite.afterSync(is.changes), log.level.Detail);
|
log.wrap("invite", () => is.invite.afterSync(is.changes), log.level.Detail);
|
||||||
if (is.isNewInvite) {
|
if (is.isNewInvite) {
|
||||||
this._session.addInviteAfterSync(is.invite);
|
this._session.addInviteAfterSync(is.invite);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
// emit room related events after txn has been closed
|
|
||||||
for(let rs of roomStates) {
|
|
||||||
log.wrap("room", log => rs.room.afterSync(rs.changes, log), log.level.Detail);
|
|
||||||
if (rs.isNewRoom) {
|
|
||||||
this._session.addRoomAfterSync(rs.room);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue