diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/pushrules/ProcessEventForPushTask.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/pushrules/ProcessEventForPushTask.kt index 7f1acfe0b5..d000d709a9 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/pushrules/ProcessEventForPushTask.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/pushrules/ProcessEventForPushTask.kt @@ -45,14 +45,14 @@ internal class DefaultProcessEventForPushTask @Inject constructor( val newJoinEvents = params.syncResponse.join .mapNotNull { (key, value) -> value.timeline?.events?.mapNotNull { - it.takeIf { !it.isInvitation() }?.copy(roomId = key) + it.takeIf { !it.isInvitation() }?.copyAll(roomId = key) } } .flatten() val inviteEvents = params.syncResponse.invite .mapNotNull { (key, value) -> - value.inviteState?.events?.map { it.copy(roomId = key) } + value.inviteState?.events?.map { it.copyAll(roomId = key) } } .flatten() @@ -75,7 +75,6 @@ internal class DefaultProcessEventForPushTask @Inject constructor( " to check for push rules with ${params.rules.size} rules" ) val matchedEvents = allEvents.mapNotNull { event -> - eventDecryptor.decryptEventAndSaveResult(event, "") pushRuleFinder.fulfilledBingRule(event, params.rules)?.let { Timber.v("[PushRules] Rule $it match for event ${event.eventId}") event to it diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/handler/room/RoomSyncHandler.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/handler/room/RoomSyncHandler.kt index 5e4886ce1e..f37e384b51 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/handler/room/RoomSyncHandler.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/handler/room/RoomSyncHandler.kt @@ -437,6 +437,10 @@ internal class RoomSyncHandler @Inject constructor( if (event.isEncrypted() && !isInitialSync) { try { decryptIfNeeded(event, roomId) + // share the decryption result with the rawEvent because the decryption is done on a copy containing the roomId, see previous comment + rawEvent.mxDecryptionResult = event.mxDecryptionResult + rawEvent.mCryptoError = event.mCryptoError + rawEvent.mCryptoErrorReason = event.mCryptoErrorReason } catch (e: InterruptedException) { Timber.i("Decryption got interrupted") }