Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 06df5d4

Browse files
MSC2716v4 room version - remove namespace from MSC2716 event content fields (#13551)
Complement PR: matrix-org/complement#450 As suggested in matrix-org/matrix-spec-proposals#2716 (comment)
1 parent f9f0342 commit 06df5d4

File tree

5 files changed

+25
-24
lines changed

5 files changed

+25
-24
lines changed

changelog.d/13551.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add `org.matrix.msc2716v4` experimental room version with updated content fields.

synapse/api/constants.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,11 +216,11 @@ class EventContentFields:
216216
MSC2716_HISTORICAL: Final = "org.matrix.msc2716.historical"
217217
# For "insertion" events to indicate what the next batch ID should be in
218218
# order to connect to it
219-
MSC2716_NEXT_BATCH_ID: Final = "org.matrix.msc2716.next_batch_id"
219+
MSC2716_NEXT_BATCH_ID: Final = "next_batch_id"
220220
# Used on "batch" events to indicate which insertion event it connects to
221-
MSC2716_BATCH_ID: Final = "org.matrix.msc2716.batch_id"
221+
MSC2716_BATCH_ID: Final = "batch_id"
222222
# For "marker" events
223-
MSC2716_MARKER_INSERTION: Final = "org.matrix.msc2716.marker.insertion"
223+
MSC2716_INSERTION_EVENT_REFERENCE: Final = "insertion_event_reference"
224224

225225
# The authorising user for joining a restricted room.
226226
AUTHORISING_USER: Final = "join_authorised_via_users_server"

synapse/api/room_versions.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -269,24 +269,6 @@ class RoomVersions:
269269
msc3787_knock_restricted_join_rule=False,
270270
msc3667_int_only_power_levels=False,
271271
)
272-
MSC2716v3 = RoomVersion(
273-
"org.matrix.msc2716v3",
274-
RoomDisposition.UNSTABLE,
275-
EventFormatVersions.V3,
276-
StateResolutionVersions.V2,
277-
enforce_key_validity=True,
278-
special_case_aliases_auth=False,
279-
strict_canonicaljson=True,
280-
limit_notifications_power_levels=True,
281-
msc2176_redaction_rules=False,
282-
msc3083_join_rules=False,
283-
msc3375_redaction_rules=False,
284-
msc2403_knocking=True,
285-
msc2716_historical=True,
286-
msc2716_redactions=True,
287-
msc3787_knock_restricted_join_rule=False,
288-
msc3667_int_only_power_levels=False,
289-
)
290272
MSC3787 = RoomVersion(
291273
"org.matrix.msc3787",
292274
RoomDisposition.UNSTABLE,
@@ -323,6 +305,24 @@ class RoomVersions:
323305
msc3787_knock_restricted_join_rule=True,
324306
msc3667_int_only_power_levels=True,
325307
)
308+
MSC2716v4 = RoomVersion(
309+
"org.matrix.msc2716v4",
310+
RoomDisposition.UNSTABLE,
311+
EventFormatVersions.V3,
312+
StateResolutionVersions.V2,
313+
enforce_key_validity=True,
314+
special_case_aliases_auth=False,
315+
strict_canonicaljson=True,
316+
limit_notifications_power_levels=True,
317+
msc2176_redaction_rules=False,
318+
msc3083_join_rules=False,
319+
msc3375_redaction_rules=False,
320+
msc2403_knocking=True,
321+
msc2716_historical=True,
322+
msc2716_redactions=True,
323+
msc3787_knock_restricted_join_rule=False,
324+
msc3667_int_only_power_levels=False,
325+
)
326326

327327

328328
KNOWN_ROOM_VERSIONS: Dict[str, RoomVersion] = {
@@ -338,9 +338,9 @@ class RoomVersions:
338338
RoomVersions.V7,
339339
RoomVersions.V8,
340340
RoomVersions.V9,
341-
RoomVersions.MSC2716v3,
342341
RoomVersions.MSC3787,
343342
RoomVersions.V10,
343+
RoomVersions.MSC2716v4,
344344
)
345345
}
346346

synapse/events/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def add_fields(*fields: str) -> None:
161161
elif room_version.msc2716_redactions and event_type == EventTypes.MSC2716_BATCH:
162162
add_fields(EventContentFields.MSC2716_BATCH_ID)
163163
elif room_version.msc2716_redactions and event_type == EventTypes.MSC2716_MARKER:
164-
add_fields(EventContentFields.MSC2716_MARKER_INSERTION)
164+
add_fields(EventContentFields.MSC2716_INSERTION_EVENT_REFERENCE)
165165

166166
allowed_fields = {k: v for k, v in event_dict.items() if k in allowed_keys}
167167

synapse/handlers/federation_event.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1384,7 +1384,7 @@ async def _handle_marker_event(self, origin: str, marker_event: EventBase) -> No
13841384
logger.debug("_handle_marker_event: received %s", marker_event)
13851385

13861386
insertion_event_id = marker_event.content.get(
1387-
EventContentFields.MSC2716_MARKER_INSERTION
1387+
EventContentFields.MSC2716_INSERTION_EVENT_REFERENCE
13881388
)
13891389

13901390
if insertion_event_id is None:

0 commit comments

Comments
 (0)