From 3c9004d87da98376a0db6965496ea89c49c21263 Mon Sep 17 00:00:00 2001 From: Alex Hart Date: Wed, 9 Aug 2023 09:56:29 -0300 Subject: [PATCH] Remove maximum denial tracking. --- .../webrtc/PendingParticipantCollection.kt | 6 +----- .../PendingParticipantCollectionTest.kt | 20 ------------------- 2 files changed, 1 insertion(+), 25 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/service/webrtc/PendingParticipantCollection.kt b/app/src/main/java/org/thoughtcrime/securesms/service/webrtc/PendingParticipantCollection.kt index 9f30863e20..d9d2cb377e 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/service/webrtc/PendingParticipantCollection.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/service/webrtc/PendingParticipantCollection.kt @@ -21,10 +21,6 @@ data class PendingParticipantCollection( private val nowProvider: () -> Duration = { System.currentTimeMillis().milliseconds } ) { - companion object { - private val MAX_DENIALS = 2 - } - /** * Creates a new collection with the given recipients applied to it with the following rules: * @@ -47,7 +43,7 @@ data class PendingParticipantCollection( val newEntryMap = (participantMap + newEntries) .filterNot { it.value.state == State.PENDING && it.key !in submittedIdSet } .mapValues { - if (it.value.state == State.DENIED && it.key in submittedIdSet && it.value.denialCount < MAX_DENIALS) { + if (it.value.state == State.DENIED && it.key in submittedIdSet) { it.value.copy(state = State.PENDING, stateChangeAt = now) } else { it.value diff --git a/app/src/test/java/org/thoughtcrime/securesms/service/webrtc/PendingParticipantCollectionTest.kt b/app/src/test/java/org/thoughtcrime/securesms/service/webrtc/PendingParticipantCollectionTest.kt index 58f64ba8d2..07e54b1ac1 100644 --- a/app/src/test/java/org/thoughtcrime/securesms/service/webrtc/PendingParticipantCollectionTest.kt +++ b/app/src/test/java/org/thoughtcrime/securesms/service/webrtc/PendingParticipantCollectionTest.kt @@ -245,26 +245,6 @@ class PendingParticipantCollectionTest { assertEquals(expected, actual.first()) } - @Test - fun `Given a participant is denied twice, when I withRecipients, then I expect the state to be DENIED`() { - val recipients = createRecipients(1) - val expected = PendingParticipantCollection.Entry( - recipient = recipients[0], - state = PendingParticipantCollection.State.DENIED, - stateChangeAt = 2.milliseconds, - denialCount = 2 - ) - - val actual = testSubject - .withRecipients(recipients) - .withDenial(recipients[0]) - .withDenial(recipients[0]) - .withRecipients(recipients) - .getAllPendingParticipants(0.milliseconds) - - assertEquals(expected, actual.first()) - } - private fun createRecipients(count: Int): List { return (1..count).map { RecipientDatabaseTestUtils.createRecipient() } }