Skip to content
Snippets Groups Projects
Unverified Commit 08bc80ef authored by Patrick Cloke's avatar Patrick Cloke Committed by GitHub
Browse files

Implement room version 6 (MSC2240). (#7506)

parent 02d97fc3
No related branches found
No related tags found
No related merge requests found
Implement room version 6 per [MSC2240](https://github.com/matrix-org/matrix-doc/pull/2240).
...@@ -120,34 +120,14 @@ class RoomVersions(object): ...@@ -120,34 +120,14 @@ class RoomVersions(object):
strict_canonicaljson=False, strict_canonicaljson=False,
limit_notifications_power_levels=False, limit_notifications_power_levels=False,
) )
MSC2432_DEV = RoomVersion( V6 = RoomVersion(
"org.matrix.msc2432", "6",
RoomDisposition.UNSTABLE, RoomDisposition.STABLE,
EventFormatVersions.V3, EventFormatVersions.V3,
StateResolutionVersions.V2, StateResolutionVersions.V2,
enforce_key_validity=True, enforce_key_validity=True,
special_case_aliases_auth=False, 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, 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, limit_notifications_power_levels=True,
) )
...@@ -160,8 +140,6 @@ KNOWN_ROOM_VERSIONS = { ...@@ -160,8 +140,6 @@ KNOWN_ROOM_VERSIONS = {
RoomVersions.V3, RoomVersions.V3,
RoomVersions.V4, RoomVersions.V4,
RoomVersions.V5, RoomVersions.V5,
RoomVersions.MSC2432_DEV, RoomVersions.V6,
RoomVersions.STRICT_CANONICALJSON,
RoomVersions.MSC2209_DEV,
) )
} # type: Dict[str, RoomVersion] } # type: Dict[str, RoomVersion]
...@@ -156,7 +156,7 @@ class PruneEventTestCase(unittest.TestCase): ...@@ -156,7 +156,7 @@ class PruneEventTestCase(unittest.TestCase):
"signatures": {}, "signatures": {},
"unsigned": {}, "unsigned": {},
}, },
room_version=RoomVersions.MSC2432_DEV, room_version=RoomVersions.V6,
) )
......
...@@ -226,7 +226,7 @@ class EventFromPduTestCase(TestCase): ...@@ -226,7 +226,7 @@ class EventFromPduTestCase(TestCase):
"auth_events": [], "auth_events": [],
"origin_server_ts": 1234, "origin_server_ts": 1234,
}, },
RoomVersions.STRICT_CANONICALJSON, RoomVersions.V6,
) )
self.assertIsInstance(ev, EventBase) self.assertIsInstance(ev, EventBase)
...@@ -253,7 +253,7 @@ class EventFromPduTestCase(TestCase): ...@@ -253,7 +253,7 @@ class EventFromPduTestCase(TestCase):
"auth_events": [], "auth_events": [],
"origin_server_ts": 1234, "origin_server_ts": 1234,
}, },
RoomVersions.STRICT_CANONICALJSON, RoomVersions.V6,
) )
def test_invalid_nested(self): def test_invalid_nested(self):
...@@ -270,5 +270,5 @@ class EventFromPduTestCase(TestCase): ...@@ -270,5 +270,5 @@ class EventFromPduTestCase(TestCase):
"auth_events": [], "auth_events": [],
"origin_server_ts": 1234, "origin_server_ts": 1234,
}, },
RoomVersions.STRICT_CANONICALJSON, RoomVersions.V6,
) )
...@@ -136,21 +136,18 @@ class EventAuthTestCase(unittest.TestCase): ...@@ -136,21 +136,18 @@ class EventAuthTestCase(unittest.TestCase):
# creator should be able to send aliases # creator should be able to send aliases
event_auth.check( event_auth.check(
RoomVersions.MSC2432_DEV, RoomVersions.V6, _alias_event(creator), auth_events, do_sig_check=False,
_alias_event(creator),
auth_events,
do_sig_check=False,
) )
# No particular checks are done on the state key. # No particular checks are done on the state key.
event_auth.check( event_auth.check(
RoomVersions.MSC2432_DEV, RoomVersions.V6,
_alias_event(creator, state_key=""), _alias_event(creator, state_key=""),
auth_events, auth_events,
do_sig_check=False, do_sig_check=False,
) )
event_auth.check( event_auth.check(
RoomVersions.MSC2432_DEV, RoomVersions.V6,
_alias_event(creator, state_key="test.com"), _alias_event(creator, state_key="test.com"),
auth_events, auth_events,
do_sig_check=False, do_sig_check=False,
...@@ -159,10 +156,7 @@ class EventAuthTestCase(unittest.TestCase): ...@@ -159,10 +156,7 @@ class EventAuthTestCase(unittest.TestCase):
# Per standard auth rules, the member must be in the room. # Per standard auth rules, the member must be in the room.
with self.assertRaises(AuthError): with self.assertRaises(AuthError):
event_auth.check( event_auth.check(
RoomVersions.MSC2432_DEV, RoomVersions.V6, _alias_event(other), auth_events, do_sig_check=False,
_alias_event(other),
auth_events,
do_sig_check=False,
) )
def test_msc2209(self): def test_msc2209(self):
...@@ -192,7 +186,7 @@ class EventAuthTestCase(unittest.TestCase): ...@@ -192,7 +186,7 @@ class EventAuthTestCase(unittest.TestCase):
# But an MSC2209 room rejects this change. # But an MSC2209 room rejects this change.
with self.assertRaises(AuthError): with self.assertRaises(AuthError):
event_auth.check( event_auth.check(
RoomVersions.MSC2209_DEV, RoomVersions.V6,
_power_levels_event(pleb, {"notifications": {"room": 100}}), _power_levels_event(pleb, {"notifications": {"room": 100}}),
auth_events, auth_events,
do_sig_check=False, do_sig_check=False,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment