diff --git a/app/src/main/kotlin/com/wire/android/ui/home/conversations/details/participants/usecase/ObserveParticipantsForConversationUseCase.kt b/app/src/main/kotlin/com/wire/android/ui/home/conversations/details/participants/usecase/ObserveParticipantsForConversationUseCase.kt index 7c3d0d58f00..083a94ef64b 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/conversations/details/participants/usecase/ObserveParticipantsForConversationUseCase.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/conversations/details/participants/usecase/ObserveParticipantsForConversationUseCase.kt @@ -78,9 +78,9 @@ class ObserveParticipantsForConversationUseCase @Inject constructor( ConversationParticipantsData( admins = visibleAdminsWithoutServices - .map { uiParticipantMapper.toUIParticipant(it.user, mlsVerificationMap[it.user.id].let { false }) }, + .map { uiParticipantMapper.toUIParticipant(it.user, mlsVerificationMap[it.user.id] ?: false) }, participants = visibleParticipants - .map { uiParticipantMapper.toUIParticipant(it.user, mlsVerificationMap[it.user.id].let { false }) }, + .map { uiParticipantMapper.toUIParticipant(it.user, mlsVerificationMap[it.user.id] ?: false) }, allAdminsCount = allAdminsWithoutServices.size, allParticipantsCount = allParticipants.size, isSelfAnAdmin = allAdminsWithoutServices.any { it.user is SelfUser }, diff --git a/app/src/test/kotlin/com/wire/android/ui/home/conversations/details/participants/usecase/ObserveParticipantsForConversationUseCaseTest.kt b/app/src/test/kotlin/com/wire/android/ui/home/conversations/details/participants/usecase/ObserveParticipantsForConversationUseCaseTest.kt index 6eb44e1f24e..dc0e39f3f6c 100644 --- a/app/src/test/kotlin/com/wire/android/ui/home/conversations/details/participants/usecase/ObserveParticipantsForConversationUseCaseTest.kt +++ b/app/src/test/kotlin/com/wire/android/ui/home/conversations/details/participants/usecase/ObserveParticipantsForConversationUseCaseTest.kt @@ -75,14 +75,21 @@ class ObserveParticipantsForConversationUseCaseTest { add(MemberDetails(testOtherUser(i).copy(userType = UserType.INTERNAL), Member.Role.Member)) } } + val userId1 = UserId(value = "value1", domain = "domain1") + val userId2 = UserId(value = "value2", domain = "domain2") + val userId3 = UserId(value = "value3", domain = "domain3") val (_, useCase) = ObserveParticipantsForConversationUseCaseArrangement() .withConversationParticipantsUpdate(members) + .withE2EICertificateStatuses(mapOf(userId1 to true, userId2 to false)) .arrange() // When - Then useCase(ConversationId("", "")).test { val data = awaitItem() assert(data.participants.size == members.size) assert(data.allParticipantsCount == members.size) + assertEquals(true, data.participants.firstOrNull { it.id == userId1 }?.isMLSVerified) + assertEquals(false, data.participants.firstOrNull { it.id == userId2 }?.isMLSVerified) + assertEquals(false, data.participants.firstOrNull { it.id == userId3 }?.isMLSVerified) // false if null } } @@ -244,5 +251,9 @@ internal class ObserveParticipantsForConversationUseCaseArrangement { return this } + suspend fun withE2EICertificateStatuses(result: Map) = apply { + coEvery { getMembersE2EICertificateStatuses(any(), any()) } answers { result } + } + fun arrange() = this to useCase }