Skip to content

Commit 555cc0e

Browse files
clokepphil-flex
authored andcommitted
Implement room version 6 (MSC2240). (matrix-org#7506)
1 parent f084b08 commit 555cc0e

File tree

5 files changed

+14
-41
lines changed

5 files changed

+14
-41
lines changed

changelog.d/7506.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Implement room version 6 per [MSC2240](https://github.com/matrix-org/matrix-doc/pull/2240).

synapse/api/room_versions.py

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -120,34 +120,14 @@ class RoomVersions(object):
120120
strict_canonicaljson=False,
121121
limit_notifications_power_levels=False,
122122
)
123-
MSC2432_DEV = RoomVersion(
124-
"org.matrix.msc2432",
125-
RoomDisposition.UNSTABLE,
123+
V6 = RoomVersion(
124+
"6",
125+
RoomDisposition.STABLE,
126126
EventFormatVersions.V3,
127127
StateResolutionVersions.V2,
128128
enforce_key_validity=True,
129129
special_case_aliases_auth=False,
130-
strict_canonicaljson=False,
131-
limit_notifications_power_levels=False,
132-
)
133-
STRICT_CANONICALJSON = RoomVersion(
134-
"org.matrix.strict_canonicaljson",
135-
RoomDisposition.UNSTABLE,
136-
EventFormatVersions.V3,
137-
StateResolutionVersions.V2,
138-
enforce_key_validity=True,
139-
special_case_aliases_auth=True,
140130
strict_canonicaljson=True,
141-
limit_notifications_power_levels=False,
142-
)
143-
MSC2209_DEV = RoomVersion(
144-
"org.matrix.msc2209",
145-
RoomDisposition.UNSTABLE,
146-
EventFormatVersions.V3,
147-
StateResolutionVersions.V2,
148-
enforce_key_validity=True,
149-
special_case_aliases_auth=True,
150-
strict_canonicaljson=False,
151131
limit_notifications_power_levels=True,
152132
)
153133

@@ -160,8 +140,6 @@ class RoomVersions(object):
160140
RoomVersions.V3,
161141
RoomVersions.V4,
162142
RoomVersions.V5,
163-
RoomVersions.MSC2432_DEV,
164-
RoomVersions.STRICT_CANONICALJSON,
165-
RoomVersions.MSC2209_DEV,
143+
RoomVersions.V6,
166144
)
167145
} # type: Dict[str, RoomVersion]

tests/events/test_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ def test_msc2432_alias_event(self):
156156
"signatures": {},
157157
"unsigned": {},
158158
},
159-
room_version=RoomVersions.MSC2432_DEV,
159+
room_version=RoomVersions.V6,
160160
)
161161

162162

tests/handlers/test_federation.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ def test_valid_json(self):
226226
"auth_events": [],
227227
"origin_server_ts": 1234,
228228
},
229-
RoomVersions.STRICT_CANONICALJSON,
229+
RoomVersions.V6,
230230
)
231231

232232
self.assertIsInstance(ev, EventBase)
@@ -253,7 +253,7 @@ def test_invalid_numbers(self):
253253
"auth_events": [],
254254
"origin_server_ts": 1234,
255255
},
256-
RoomVersions.STRICT_CANONICALJSON,
256+
RoomVersions.V6,
257257
)
258258

259259
def test_invalid_nested(self):
@@ -270,5 +270,5 @@ def test_invalid_nested(self):
270270
"auth_events": [],
271271
"origin_server_ts": 1234,
272272
},
273-
RoomVersions.STRICT_CANONICALJSON,
273+
RoomVersions.V6,
274274
)

tests/test_event_auth.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -136,21 +136,18 @@ def test_msc2432_alias_event(self):
136136

137137
# creator should be able to send aliases
138138
event_auth.check(
139-
RoomVersions.MSC2432_DEV,
140-
_alias_event(creator),
141-
auth_events,
142-
do_sig_check=False,
139+
RoomVersions.V6, _alias_event(creator), auth_events, do_sig_check=False,
143140
)
144141

145142
# No particular checks are done on the state key.
146143
event_auth.check(
147-
RoomVersions.MSC2432_DEV,
144+
RoomVersions.V6,
148145
_alias_event(creator, state_key=""),
149146
auth_events,
150147
do_sig_check=False,
151148
)
152149
event_auth.check(
153-
RoomVersions.MSC2432_DEV,
150+
RoomVersions.V6,
154151
_alias_event(creator, state_key="test.com"),
155152
auth_events,
156153
do_sig_check=False,
@@ -159,10 +156,7 @@ def test_msc2432_alias_event(self):
159156
# Per standard auth rules, the member must be in the room.
160157
with self.assertRaises(AuthError):
161158
event_auth.check(
162-
RoomVersions.MSC2432_DEV,
163-
_alias_event(other),
164-
auth_events,
165-
do_sig_check=False,
159+
RoomVersions.V6, _alias_event(other), auth_events, do_sig_check=False,
166160
)
167161

168162
def test_msc2209(self):
@@ -192,7 +186,7 @@ def test_msc2209(self):
192186
# But an MSC2209 room rejects this change.
193187
with self.assertRaises(AuthError):
194188
event_auth.check(
195-
RoomVersions.MSC2209_DEV,
189+
RoomVersions.V6,
196190
_power_levels_event(pleb, {"notifications": {"room": 100}}),
197191
auth_events,
198192
do_sig_check=False,

0 commit comments

Comments
 (0)