Chat trial on Matrix, off unless configured #24

Merged
sergi merged 5 commits from feat/matrix-spike into main 2026-10-30 18:32:01 +01:00
Owner

Chat between class members on a Matrix homeserver (Synapse), as a trial.

  • make local-matrix runs a local Synapse (client API only, no federation, no sign-ups).
  • POST /api/matrix/session creates the user's Matrix account on first use, without a password, and issues a token that expires with the Ragoon session.
  • GET /api/matrix/workspaces/{id}/rooms creates a class's Announcements (teachers post) and General rooms on first use, after checking class membership in Ragoon.
  • A Messages pane in classes, on matrix-js-sdk 44.0.0; closing it signs out and revokes the token.
  • Off unless MATRIX_HOMESERVER_URL and MATRIX_ADMIN_TOKEN are set; the Messages button only appears when they are.

Known gaps before real use (tracked in ragoon-deploy/docs/matrix-chat.md): leaving a class keeps room access, rooms are not deleted with their class, no retention period yet, security review and the school's privacy sign-off pending.

Testing: backend pytest (167), frontend npm run check (196), plus checks against a local Synapse and a manual try in the browser.

Chat between class members on a Matrix homeserver (Synapse), as a trial. - make local-matrix runs a local Synapse (client API only, no federation, no sign-ups). - POST /api/matrix/session creates the user's Matrix account on first use, without a password, and issues a token that expires with the Ragoon session. - GET /api/matrix/workspaces/{id}/rooms creates a class's Announcements (teachers post) and General rooms on first use, after checking class membership in Ragoon. - A Messages pane in classes, on matrix-js-sdk 44.0.0; closing it signs out and revokes the token. - Off unless MATRIX_HOMESERVER_URL and MATRIX_ADMIN_TOKEN are set; the Messages button only appears when they are. Known gaps before real use (tracked in ragoon-deploy/docs/matrix-chat.md): leaving a class keeps room access, rooms are not deleted with their class, no retention period yet, security review and the school's privacy sign-off pending. Testing: backend pytest (167), frontend npm run check (196), plus checks against a local Synapse and a manual try in the browser.
make local-matrix runs a pinned Synapse (1.163.0) with uv, client API only on 127.0.0.1:8008, federation and sign-ups off, with its data in the ignored .local-stack/synapse. The first run creates the backend's admin account and prints the settings for backend/.env.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
POST /api/matrix/session creates the user's Matrix account on first use, without a password, and returns a token from Synapse's admin login API that expires with the Ragoon session, so there is only one sign-in.

The admin token stays in the backend, the response is never cached, and account creation and issued sessions are audited without the token. Chat is off until MATRIX_HOMESERVER_URL and MATRIX_ADMIN_TOKEN are set.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GET /api/matrix/workspaces/{id}/rooms returns a class's Matrix space with Announcements (only class owners post) and General, creating them the first time and adding the caller after checking their class membership in Ragoon.

Rooms are invite-only, closed to guests and out of the directory; only Ragoon's service account invites people or changes settings, and class owners moderate. Leaving a class does not yet remove the Matrix membership.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
In a class, a Messages button opens its Announcements and General rooms next to Files and Calendar, on matrix-js-sdk 44.0.0, which loads only when the pane opens. Students read announcements and post in General; teachers post in both.

Each opening gets a new Matrix session and closing the pane signs out, which revokes the token, so tokens live only while the pane is open.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
feat: show Messages only where chat is set up
All checks were successful
ragoon-ui-ci / validate (pull_request) Successful in 8m3s
74ca3e99cd
The session now says whether the server has Matrix configured (chat_enabled), and the Messages button appears only then, so deployments without a homeserver show no trace of chat and the trial can merge into main safely.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sergi merged commit c3ab74fe1e into main 2026-10-30 18:32:01 +01:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
sergi/ragoon-ui!24
No description provided.