Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Shields not shown in group participants list [WPB-10255] #3274

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,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 @@ -215,5 +222,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
}
Loading