mirror of
https://github.com/element-hq/element-android
synced 2024-11-28 13:38:49 +03:00
Room left: fix state not being updated
This commit is contained in:
parent
afd1002fdb
commit
f19e2a0995
1 changed files with 11 additions and 0 deletions
|
@ -210,6 +210,17 @@ internal class RoomSyncHandler @Inject constructor(private val readReceiptHandle
|
|||
val roomEntity = RoomEntity.where(realm, roomId).findFirst() ?: realm.createObject(roomId)
|
||||
roomEntity.membership = Membership.LEAVE
|
||||
roomEntity.chunks.deleteAllFromRealm()
|
||||
for (event in roomSync.state?.events.orEmpty()) {
|
||||
if (event.eventId == null || event.stateKey == null) {
|
||||
continue
|
||||
}
|
||||
val eventEntity = event.toEntity(roomId, SendState.SYNCED).copyToRealmOrIgnore(realm)
|
||||
CurrentStateEventEntity.getOrCreate(realm, roomId, event.stateKey, event.type).apply {
|
||||
eventId = event.eventId
|
||||
root = eventEntity
|
||||
}
|
||||
roomMemberEventHandler.handle(realm, roomId, event)
|
||||
}
|
||||
roomSummaryUpdater.update(realm, roomId, Membership.LEAVE, roomSync.summary, roomSync.unreadNotifications)
|
||||
return roomEntity
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue