Skip to content

Commit

Permalink
fix: Shields not shown in group participants list [WPB-10255] πŸ’ πŸ’ (#3286
Browse files Browse the repository at this point in the history
)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: boris <[email protected]>
Co-authored-by: Alexandre Ferris <[email protected]>
  • Loading branch information
3 people authored Aug 6, 2024
1 parent 55117ba commit df3af45
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down Expand Up @@ -244,5 +251,9 @@ internal class ObserveParticipantsForConversationUseCaseArrangement {
return this
}

suspend fun withE2EICertificateStatuses(result: Map<UserId, Boolean>) = apply {
coEvery { getMembersE2EICertificateStatuses(any(), any()) } answers { result }
}

fun arrange() = this to useCase
}

0 comments on commit df3af45

Please sign in to comment.