Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/7506.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Implement room version 6 per [MSC2240](https://github.com/matrix-org/matrix-doc/pull/2240).
30 changes: 4 additions & 26 deletions synapse/api/room_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,34 +120,14 @@ class RoomVersions(object):
strict_canonicaljson=False,
limit_notifications_power_levels=False,
)
MSC2432_DEV = RoomVersion(
"org.matrix.msc2432",
RoomDisposition.UNSTABLE,
V6 = RoomVersion(
"6",
RoomDisposition.STABLE,
EventFormatVersions.V3,
StateResolutionVersions.V2,
enforce_key_validity=True,
special_case_aliases_auth=False,
strict_canonicaljson=False,
limit_notifications_power_levels=False,
)
STRICT_CANONICALJSON = RoomVersion(
"org.matrix.strict_canonicaljson",
RoomDisposition.UNSTABLE,
EventFormatVersions.V3,
StateResolutionVersions.V2,
enforce_key_validity=True,
special_case_aliases_auth=True,
strict_canonicaljson=True,
limit_notifications_power_levels=False,
)
MSC2209_DEV = RoomVersion(
"org.matrix.msc2209",
RoomDisposition.UNSTABLE,
EventFormatVersions.V3,
StateResolutionVersions.V2,
enforce_key_validity=True,
special_case_aliases_auth=True,
strict_canonicaljson=False,
limit_notifications_power_levels=True,
)

Expand All @@ -160,8 +140,6 @@ class RoomVersions(object):
RoomVersions.V3,
RoomVersions.V4,
RoomVersions.V5,
RoomVersions.MSC2432_DEV,
RoomVersions.STRICT_CANONICALJSON,
RoomVersions.MSC2209_DEV,
RoomVersions.V6,
)
} # type: Dict[str, RoomVersion]
2 changes: 1 addition & 1 deletion tests/events/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def test_msc2432_alias_event(self):
"signatures": {},
"unsigned": {},
},
room_version=RoomVersions.MSC2432_DEV,
room_version=RoomVersions.V6,
)


Expand Down
6 changes: 3 additions & 3 deletions tests/handlers/test_federation.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ def test_valid_json(self):
"auth_events": [],
"origin_server_ts": 1234,
},
RoomVersions.STRICT_CANONICALJSON,
RoomVersions.V6,
)

self.assertIsInstance(ev, EventBase)
Expand All @@ -253,7 +253,7 @@ def test_invalid_numbers(self):
"auth_events": [],
"origin_server_ts": 1234,
},
RoomVersions.STRICT_CANONICALJSON,
RoomVersions.V6,
)

def test_invalid_nested(self):
Expand All @@ -270,5 +270,5 @@ def test_invalid_nested(self):
"auth_events": [],
"origin_server_ts": 1234,
},
RoomVersions.STRICT_CANONICALJSON,
RoomVersions.V6,
)
16 changes: 5 additions & 11 deletions tests/test_event_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,21 +136,18 @@ def test_msc2432_alias_event(self):

# creator should be able to send aliases
event_auth.check(
RoomVersions.MSC2432_DEV,
_alias_event(creator),
auth_events,
do_sig_check=False,
RoomVersions.V6, _alias_event(creator), auth_events, do_sig_check=False,
)

# No particular checks are done on the state key.
event_auth.check(
RoomVersions.MSC2432_DEV,
RoomVersions.V6,
_alias_event(creator, state_key=""),
auth_events,
do_sig_check=False,
)
event_auth.check(
RoomVersions.MSC2432_DEV,
RoomVersions.V6,
_alias_event(creator, state_key="test.com"),
auth_events,
do_sig_check=False,
Expand All @@ -159,10 +156,7 @@ def test_msc2432_alias_event(self):
# Per standard auth rules, the member must be in the room.
with self.assertRaises(AuthError):
event_auth.check(
RoomVersions.MSC2432_DEV,
_alias_event(other),
auth_events,
do_sig_check=False,
RoomVersions.V6, _alias_event(other), auth_events, do_sig_check=False,
)

def test_msc2209(self):
Expand Down Expand Up @@ -192,7 +186,7 @@ def test_msc2209(self):
# But an MSC2209 room rejects this change.
with self.assertRaises(AuthError):
event_auth.check(
RoomVersions.MSC2209_DEV,
RoomVersions.V6,
_power_levels_event(pleb, {"notifications": {"room": 100}}),
auth_events,
do_sig_check=False,
Expand Down