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 // already tracked
return return
} }
if (alreadyReported.contains(eventId)) {
// already reported
return
}
val isOwnIdentityTrusted = session.cryptoService().crossSigningService().isCrossSigningVerified() val isOwnIdentityTrusted = session.cryptoService().crossSigningService().isCrossSigningVerified()
val userHS = MatrixPatterns.extractServerNameFromId(session.myUserId) val userHS = MatrixPatterns.extractServerNameFromId(session.myUserId)
val messageSenderHs = event.senderId?.let { MatrixPatterns.extractServerNameFromId(it) } val messageSenderHs = event.senderId?.let { MatrixPatterns.extractServerNameFromId(it) }

View File

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