Merge pull request #4219 from element-hq/feature/bma/encryptionBadge

Always display encryption badge
This commit is contained in:
Benoit Marty
2025-01-30 20:11:58 +01:00
committed by GitHub
4 changed files with 12 additions and 12 deletions

View File

@@ -48,12 +48,10 @@ data class RoomDetailsState(
val eventSink: (RoomDetailsEvent) -> Unit
) {
val roomBadges = buildList {
if (isEncrypted || isPublic) {
if (isEncrypted) {
add(RoomBadge.ENCRYPTED)
} else {
add(RoomBadge.NOT_ENCRYPTED)
}
if (isEncrypted) {
add(RoomBadge.ENCRYPTED)
} else {
add(RoomBadge.NOT_ENCRYPTED)
}
if (isPublic) {
add(RoomBadge.PUBLIC)

View File

@@ -13,12 +13,14 @@ import org.junit.Test
class RoomDetailsStateTest {
@Test
fun `room not public not encrypted should have no badges`() {
fun `room not public not encrypted should have not encrypted badge`() {
val sut = aRoomDetailsState(
isPublic = false,
isEncrypted = false,
)
assertThat(sut.roomBadges).isEmpty()
assertThat(sut.roomBadges).isEqualTo(
persistentListOf(RoomBadge.NOT_ENCRYPTED)
)
}
@Test