From f19e2a0995eca6e812c3064b863ea8dddb424a30 Mon Sep 17 00:00:00 2001 From: ganfra Date: Fri, 5 Jun 2020 20:09:30 +0200 Subject: [PATCH] Room left: fix state not being updated --- .../android/internal/session/sync/RoomSyncHandler.kt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/sync/RoomSyncHandler.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/sync/RoomSyncHandler.kt index 9a8c1d42db..fecfcd94ba 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/sync/RoomSyncHandler.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/sync/RoomSyncHandler.kt @@ -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 }