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

Commit

Permalink
Update constant name now that MSC3083 is merged.
Browse files Browse the repository at this point in the history
  • Loading branch information
clokep committed Jul 30, 2021
1 parent ee762af commit cc9a6f7
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 10 deletions.
2 changes: 1 addition & 1 deletion synapse/api/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class JoinRules:
INVITE = "invite"
PRIVATE = "private"
# As defined for MSC3083.
MSC3083_RESTRICTED = "restricted"
RESTRICTED = "restricted"


class RestrictedJoinRuleTypes:
Expand Down
5 changes: 1 addition & 4 deletions synapse/event_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,10 +370,7 @@ def _is_membership_change_allowed(
raise AuthError(403, "You are banned from this room")
elif join_rule == JoinRules.PUBLIC:
pass
elif (
room_version.msc3083_join_rules
and join_rule == JoinRules.MSC3083_RESTRICTED
):
elif room_version.msc3083_join_rules and join_rule == JoinRules.RESTRICTED:
# This is the same as public, but the event must contain a reference
# to the server who authorised the join. If the event does not contain
# the proper content it is rejected.
Expand Down
2 changes: 1 addition & 1 deletion synapse/handlers/event_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ async def has_restricted_join_rules(

# If the join rule is not restricted, this doesn't apply.
join_rules_event = await self._store.get_event(join_rules_event_id)
return join_rules_event.content.get("join_rule") == JoinRules.MSC3083_RESTRICTED
return join_rules_event.content.get("join_rule") == JoinRules.RESTRICTED

async def get_rooms_that_allow_join(
self, state_ids: StateMap[str]
Expand Down
8 changes: 4 additions & 4 deletions tests/handlers/test_space_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,12 +231,12 @@ def test_filtering(self):
invited_room = self._create_room_with_join_rule(JoinRules.INVITE)
self.helper.invite(invited_room, targ=user2, tok=self.token)
restricted_room = self._create_room_with_join_rule(
JoinRules.MSC3083_RESTRICTED,
JoinRules.RESTRICTED,
room_version=RoomVersions.V8.identifier,
allow=[],
)
restricted_accessible_room = self._create_room_with_join_rule(
JoinRules.MSC3083_RESTRICTED,
JoinRules.RESTRICTED,
room_version=RoomVersions.V8.identifier,
allow=[
{
Expand Down Expand Up @@ -459,13 +459,13 @@ async def summarize_remote_room(
{
"room_id": restricted_room,
"world_readable": False,
"join_rules": JoinRules.MSC3083_RESTRICTED,
"join_rules": JoinRules.RESTRICTED,
"allowed_spaces": [],
},
{
"room_id": restricted_accessible_room,
"world_readable": False,
"join_rules": JoinRules.MSC3083_RESTRICTED,
"join_rules": JoinRules.RESTRICTED,
"allowed_spaces": [self.room],
},
{
Expand Down

0 comments on commit cc9a6f7

Please sign in to comment.