4.2 KiB
Room upgrades
"Upgrading" a room is supposed to create a new room and then tries to set it up exactly like the old one. So it copies name, topic, power levels, space membership, etc. The old room is marked as old with an m.room.tombstone event, its power levels are adjusted to make it harder to send messages, and a hyperlink to the new room is added.
What happens?
A room upgrade is triggered by a POST request to /_matrix/client/v3/rooms/{roomId}/upgrade. The upgrade process is done by the server, and involves multiple events across multiple rooms. Since this is server-specific, what will actually happen depends on the server's implementation, but the spec says it does this:
-
Checks that the user has permission to send
m.room.tombstoneevents in the room. -
Creates a replacement room with a
m.room.createevent containing a predecessor field, the applicableroom_version, and atypefield which is copied from the predecessor room. If notypeis set on the previous room, notypeis specified on the new room’s create event either. -
Replicates transferable state events to the new room. The exact details for what is transferred is left as an implementation detail, however the recommended state events to transfer are:
m.room.server_aclm.room.encryptionm.room.namem.room.avatarm.room.topicm.room.guest_accessm.room.history_visibilitym.room.join_rulesm.room.power_levels
(Membership can't be transferred by the server.)
-
Moves any local aliases to the new room.
-
Sends a
m.room.tombstoneevent to the old room to indicate that it is not intended to be used any further. -
If possible, the power levels in the old room should also be modified to prevent sending of events and inviting new users. For example, setting
events_defaultandinviteto the greater of50andusers_default + 1.
Synapse additionally:
- Copies its
m.space.childevents (if it was a space).- This is good for OOYE, because it automatically tries to join new rooms when they're added to a registered space.
- Copies bans.
- Un/publishes to the public room directory as applicable.
- Copies user tags and push rules.
Conduwuit does not do those!
Element additionally:
- May invite all users from the old room to the new room, depending on if the checkbox is checked in the dialog.
- Update parent spaces to remove the old room and add the new room.
Cinny does not do those! The new room is totally detached! The hyperlink from the old room (and the moved alias by server) is the only way to find it!
- This is probably still okay for OOYE? Since the join rules are preserved, and if they were
restricted, OOYE is able to join via the tombstone hyperlink. Then, after it joins, it's already PL 100 since the power levels are preserved. It's very bad if the join rules wereinvite, but OOYE never sets this join rule - it's eitherrestrictedorpublic.
Other clients
Nheko doesn't support room upgrades at all. Cinyy, NeoChat and FluffyChat just call the API and don't do anything. FluffyChat invites all joined/invited users to the new room if the join rule is restricted.
Notable things that don't happen at all:
- Add
m.space.parentpointing to the space it was in (if it was a room in a space).
What should OOYE do?
Ideal case (Element, Synapse)
The new room is added to the space and OOYE autojoins it. It already has the correct power levels and join rules.
OOYE still needs to do this:
- Un/set
m.room.parentin the rooms. - Update
channel_roomandhistorical_channel_roomtables.
Not ideal case (everyone else)
OOYE should:
- Join the room by following the hyperlink from the tombstone, if able
- If not able, somebody messed with the join rules. Send a PM to the user who upgraded - the new room's creator - asking for an invite.
- Wait for join.
- Un/set
m.space.childevents on the space. - Un/set
m.room.parentin the rooms. - Update
channel_roomandhistorical_channel_roomtables. - Un/publish to the room directory.
It's actually fine to do all the steps always
Even by blindly following the entire list, each step is a no-op or atomic, so it doesn't matter if Element is also trying to do them.