From df3af453353174d413e3f0b19bf27bef7f2c1114 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 6 Aug 2024 08:49:36 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20Shields=20not=20shown=20in=20group=20par?= =?UTF-8?q?ticipants=20list=20[WPB-10255]=20=F0=9F=8D=92=20=F0=9F=8D=92=20?= =?UTF-8?q?(#3286)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: boris Co-authored-by: Alexandre Ferris --- .../ObserveParticipantsForConversationUseCase.kt | 4 ++-- .../ObserveParticipantsForConversationUseCaseTest.kt | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) 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 }