mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-22 01:15:54 +03:00
Update decryption result on the events from the sync response
As the decryption is done on a copy of the event (containing the roomId), we have to update the initial event with the decryption result
This commit is contained in:
parent
245ca13049
commit
084bd44348
2 changed files with 6 additions and 3 deletions
|
@ -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
|
||||
|
|
|
@ -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")
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue