Skip to content

Commit

Permalink
Fix assignment issue. sessionId was used instead of roomId.
Browse files Browse the repository at this point in the history
This may fix issue of Event not decrypted if the key is coming late for the last Event displayed in the Room list.
  • Loading branch information
bmarty committed Feb 1, 2024
1 parent e04bfe8 commit ec96f4e
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ internal class RustCryptoService @Inject constructor(
}

private fun notifyRoomKeyReceived(
roomId: String,
roomId: String?,
sessionId: String,
) {
megolmSessionImportManager.dispatchNewSession(roomId, sessionId)
Expand Down Expand Up @@ -665,17 +665,17 @@ internal class RustCryptoService @Inject constructor(
EventType.ROOM_KEY -> {
val content = event.getClearContent().toModel<RoomKeyContent>() ?: return@forEach

val roomId = content.sessionId ?: return@forEach
val sessionId = content.sessionId
val roomId = content.roomId
val sessionId = content.sessionId ?: return@forEach

notifyRoomKeyReceived(roomId, sessionId)
matrixConfiguration.cryptoAnalyticsPlugin?.onRoomKeyImported(sessionId, EventType.ROOM_KEY)
}
EventType.FORWARDED_ROOM_KEY -> {
val content = event.getClearContent().toModel<ForwardedRoomKeyContent>() ?: return@forEach

val roomId = content.sessionId ?: return@forEach
val sessionId = content.sessionId
val roomId = content.roomId
val sessionId = content.sessionId ?: return@forEach

notifyRoomKeyReceived(roomId, sessionId)
matrixConfiguration.cryptoAnalyticsPlugin?.onRoomKeyImported(sessionId, EventType.FORWARDED_ROOM_KEY)
Expand Down

0 comments on commit ec96f4e

Please sign in to comment.