Fix: should remember already reported events

This commit is contained in:
Valere 2024-04-02 09:33:10 +02:00
parent 0f3f2b164e
commit 2bbb49bdd3
2 changed files with 8 additions and 1 deletions

View file

@ -201,6 +201,10 @@ class DecryptionFailureTracker @Inject constructor(
// already tracked
return
}
if (alreadyReported.contains(eventId)) {
// already reported
return
}
val isOwnIdentityTrusted = session.cryptoService().crossSigningService().isCrossSigningVerified()
val userHS = MatrixPatterns.extractServerNameFromId(session.myUserId)
val messageSenderHs = event.senderId?.let { MatrixPatterns.extractServerNameFromId(it) }

View file

@ -376,9 +376,12 @@ class DecryptionFailureTrackerTest {
verify(exactly = 1) { fakeAnalyticsTracker.capture(any()) }
decryptionFailureTracker.onEventDecryptionError(event, aUISIError)
runCurrent()
// advance time by 7 seconds, to be ahead of the grace period
currentFakeTime += 7_000
fakeClock.givenEpoch(currentFakeTime)
decryptionFailureTracker.onEventDecrypted(event, emptyMap())
runCurrent()