Filter out direct room in the leave space screen. Closes #5496

This commit is contained in:
Benoit Marty 2025-10-09 11:40:58 +02:00
parent eb51b5cc3f
commit 7a0e98f775
2 changed files with 48 additions and 2 deletions

View file

@ -66,7 +66,8 @@ class LeaveSpacePresenter(
.orEmpty()
.partition { it.spaceRoom.roomId == leaveSpaceHandle.id }
// By default select all rooms that can be left
selectedRoomIds = otherRooms
val otherRoomsExcludingDm = otherRooms.filter { it.spaceRoom.isDirect != true }
selectedRoomIds = otherRoomsExcludingDm
.filter { it.isLastAdmin.not() }
.map { it.spaceRoom.roomId }
leaveSpaceRooms = rooms.fold(
@ -74,7 +75,7 @@ class LeaveSpacePresenter(
AsyncData.Success(
LeaveSpaceRooms(
current = currentRoom.firstOrNull(),
others = otherRooms.toImmutableList(),
others = otherRoomsExcludingDm.toImmutableList(),
)
)
},