Merge pull request #5498 from element-hq/feature/bma/filterDirectInLeaveSpace

Filter out direct room in the leave space screen.
This commit is contained in:
Benoit Marty 2025-10-09 12:01:32 +02:00 committed by GitHub
commit 891485de50
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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(),
)
)
},