Create a new room in a space (#6061)

* Add `SpaceService.editableSpaces` and `SpaceService.addChildToSpace`

* Add `parentSpace` to `CreateRoomConfig`

* Allow setting a parent space to a room in `ConfigureRoomPresenter`, make sure the room is added to the parent space when creating it

* `ConfigureRoomPresenter`: Load the list of possible spaces a room can be added to

* Refactor `RoomVisibilityState` to internally use `JoinRuleItem`

This gets rid of `RoomAccess` and `RoomAccessItem`, and it will allow us to map the join rule items in a cleaner way to both join rules and the UI

* Implement the UI changes:

- Display the parent space.
- Allow selecting a new one.
- Import needed strings.

* Fix existing tests

* Add `@Immutable` annotation to `SpaceRoom`, since it was detected as unstable.

Maybe because of `RoomType`?

* Update screenshots

---------

Co-authored-by: ElementBot <android@element.io>
This commit is contained in:
Jorge Martin Espinosa 2026-01-26 18:23:02 +01:00 committed by GitHub
parent b37ab04ff6
commit 62768359cb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
28 changed files with 706 additions and 172 deletions

View file

@ -8,6 +8,7 @@
package io.element.android.libraries.matrix.api.spaces
import androidx.compose.runtime.Immutable
import io.element.android.libraries.matrix.api.core.RoomAlias
import io.element.android.libraries.matrix.api.core.RoomId
import io.element.android.libraries.matrix.api.room.CurrentUserMembership
@ -16,6 +17,7 @@ import io.element.android.libraries.matrix.api.room.join.JoinRule
import io.element.android.libraries.matrix.api.user.MatrixUser
import kotlinx.collections.immutable.ImmutableList
@Immutable
data class SpaceRoom(
val rawName: String?,
val displayName: String,

View file

@ -21,6 +21,11 @@ interface SpaceService {
fun spaceRoomList(id: RoomId): SpaceRoomList
/**
* Get the list of spaces in which the current user can modify their rooms (adding or removing them).
*/
suspend fun editableSpaces(): Result<List<SpaceRoom>>
fun getLeaveSpaceHandle(spaceId: RoomId): LeaveSpaceHandle
/**