Skip to content

Refactor merge bundle space - #17

Open
liviaUeno wants to merge 19 commits into
developfrom
refactor-merge-bundle-space
Open

Refactor merge bundle space#17
liviaUeno wants to merge 19 commits into
developfrom
refactor-merge-bundle-space

Conversation

@liviaUeno

Copy link
Copy Markdown
Collaborator

Merge bundles into spaces (paid spaces)

Summary

Makes spaces able to grant access to the rooms inside them, so a paid space replaces the former bundle concept: buying (or entering) a space joins the user to every room it contains. This is the backend half of retiring bundles in favour of a single "space" concept.

Previously a space was purely organisational and never granted access to its child rooms (Matrix keeps space membership and child-room access independent). This PR bridges that gap.

What's new

invite_space — enter a space and join all its rooms

New endpoint POST /_synapse/room_service/invite_space (body: space_id). It reads the space's child rooms from the m.space.child state events and joins the requesting user to each of them via the admin API, then joins the user to the space itself. Returns the list of rooms the user was joined to.

  • Child rooms are read from Matrix state, not a separate table, so the list always reflects the current contents of the space.
  • A child that was removed from the space (an m.space.child event with empty content) is ignored.
  • Joins use the admin API, so they work even for private (invite-only) rooms and spaces.
  • Used for both paid spaces (after payment) and free spaces (on entry).

space_children — list the rooms inside a space

New endpoint POST /_synapse/room_service/space_children (body: space_id). Returns every child room with its name and member count. It runs with the admin, so it returns all children — including private rooms the requesting user is not yet a member of. This powers the "what's included" view before a user enters or buys a space. Requires an authenticated user (not admin-only).

Spaces can be paid

No schema change was needed: a space already lives in the same room_business table as a room and goes through the same create/visibility/price rules. A paid space is simply access_type = "private" with price > 0, exactly like a paid room; a free space is access_type = "public" with price = 0.

Endpoints added

  • POST /_synapse/room_service/invite_space
  • POST /_synapse/room_service/space_children

Tests

  • Unit tests for invite_space (resource + service): success, missing
    space_id, empty/not-found space, joining all children, skipping removed children, and continuing past a failed join.
  • All room_service tests pass.

Notes

  • Bundles are being retired in favour of paid spaces. The bundle_service module is removed/disabled separately; this PR provides the space-side replacement for what bundles did (packaging rooms and granting access on purchase).
  • Payment itself is still handled on the client side (mocked); the backend only performs the joins once entry/purchase is confirmed.
  • The README for the room_service module is updated to document the new endpoints and the free/paid space behaviour.

@liviaUeno
liviaUeno requested a review from zZMathSP August 28, 2026 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant