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

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

Merged
merged 2 commits into from
Jul 28, 2021
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/10489.feature
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 2 additions & 0 deletions synapse/events/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ def add_fields(*fields):
add_fields("creator")
elif event_type == EventTypes.JoinRules:
add_fields("join_rule")
if room_version.msc3083_join_rules:
add_fields("allow")
elif event_type == EventTypes.PowerLevels:
add_fields(
"users",
Expand Down
43 changes: 43 additions & 0 deletions tests/events/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,49 @@ def test_redacts(self):
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):
def serialize(self, ev, fields):
Expand Down