0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-12-13 11:23:25 +01:00

Restricted rooms (MSC3083) should not have their allow key redacted. (#10489)

This commit is contained in:
Patrick Cloke 2021-07-28 07:03:01 -04:00 committed by GitHub
parent c3b037795a
commit 752fe0cd98
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 46 additions and 0 deletions

View file

@ -0,0 +1 @@
Update support for [MSC3083](https://github.com/matrix-org/matrix-doc/pull/3083) to consider changes in the MSC around which servers can issue join events.

View file

@ -109,6 +109,8 @@ def prune_event_dict(room_version: RoomVersion, event_dict: dict) -> dict:
add_fields("creator") add_fields("creator")
elif event_type == EventTypes.JoinRules: elif event_type == EventTypes.JoinRules:
add_fields("join_rule") add_fields("join_rule")
if room_version.msc3083_join_rules:
add_fields("allow")
elif event_type == EventTypes.PowerLevels: elif event_type == EventTypes.PowerLevels:
add_fields( add_fields(
"users", "users",

View file

@ -301,6 +301,49 @@ class PruneEventTestCase(unittest.TestCase):
room_version=RoomVersions.MSC2176, room_version=RoomVersions.MSC2176,
) )
def test_join_rules(self):
"""Join rules events have changed behavior starting with MSC3083."""
self.run_test(
{
"type": "m.room.join_rules",
"event_id": "$test:domain",
"content": {
"join_rule": "invite",
"allow": [],
"other_key": "stripped",
},
},
{
"type": "m.room.join_rules",
"event_id": "$test:domain",
"content": {"join_rule": "invite"},
"signatures": {},
"unsigned": {},
},
)
# After MSC3083, alias events have no special behavior.
self.run_test(
{
"type": "m.room.join_rules",
"content": {
"join_rule": "invite",
"allow": [],
"other_key": "stripped",
},
},
{
"type": "m.room.join_rules",
"content": {
"join_rule": "invite",
"allow": [],
},
"signatures": {},
"unsigned": {},
},
room_version=RoomVersions.MSC3083,
)
class SerializeEventTestCase(unittest.TestCase): class SerializeEventTestCase(unittest.TestCase):
def serialize(self, ev, fields): def serialize(self, ev, fields):