Add a POST /api/admin/v1/room-invites admin endpoint

Mints a single-use, passwordless registration token per recipient, pinned to
their address and optionally to a username, and schedules the invite emails.
The links are only ever mailed to the recipients, so the response carries a
count rather than the tokens.

Minting moves out of the queue and into the caller so a username that is
already taken is refused up front, rather than emailed out as a link nobody
can register with. That leaves the fan-out job with nothing to do, so
`SendRoomInviteEmailsJob` goes away and `SendRoomInviteEmailJob` carries the
token: it takes both the address and the invite link from it, which replaces
the `matrix.to` stub and keeps the link and its recipient together.

`manage send-room-invites` and the endpoint share the minting through
`mas_storage::room_invite`.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Devon HudsonandClaude Opus 5 committed 2026-09-28 14:22:00 -06:00
1 parent 4872e25929
commit 4ad436fb33
13 files changed
+598 -143

No files matched your search

+3 -2
View File
@@ -154,8 +154,9 @@ $ mas-cli manage register-user --yes <username>
## `manage send-room-invites`
Send a room invite email to a list of addresses. This schedules the job; a
worker must be running to actually send the emails.
Send a room invite email to a list of addresses. Each address gets a single-use,
passwordless registration token pinned to it, and a link to register with it.
This schedules the emails; a worker must be running to actually send them.
Arguments:
- `<room_id>`: The room to invite the recipients to.