Fix: ER showing shields in clear rooms

This commit is contained in:
valere 2022-12-08 18:06:05 +01:00
parent bfe6207a63
commit 4766bc709d
2 changed files with 8 additions and 4 deletions

View File

@ -100,7 +100,7 @@ internal class CryptoSessionInfoProvider @Inject constructor(
return roomIds.orEmpty()
}
fun updateShieldForRoom(roomId: String, shield: RoomEncryptionTrustLevel) {
fun updateShieldForRoom(roomId: String, shield: RoomEncryptionTrustLevel?) {
monarchy.writeAsync { realm ->
val summary = RoomSummaryEntity.where(realm, roomId = roomId).findFirst()
summary?.roomEncryptionTrustLevel = shield

View File

@ -145,9 +145,13 @@ internal class OutgoingRequestsProcessor @Inject constructor(
private fun CoroutineScope.updateShields(olmMachine: OlmMachine, userIds: List<String>) = launch {
cryptoSessionInfoProvider.getRoomsWhereUsersAreParticipating(userIds).forEach { roomId ->
val userGroup = cryptoSessionInfoProvider.getUserListForShieldComputation(roomId)
val shield = computeShieldForGroup(olmMachine, userGroup)
cryptoSessionInfoProvider.updateShieldForRoom(roomId, shield)
if (cryptoSessionInfoProvider.isRoomEncrypted(roomId)) {
val userGroup = cryptoSessionInfoProvider.getUserListForShieldComputation(roomId)
val shield = computeShieldForGroup(olmMachine, userGroup)
cryptoSessionInfoProvider.updateShieldForRoom(roomId, shield)
} else {
cryptoSessionInfoProvider.updateShieldForRoom(roomId, null)
}
}
}