summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--synapse/third_party_rules/access_rules.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/synapse/third_party_rules/access_rules.py b/synapse/third_party_rules/access_rules.py
index 07b449ab32..c37737ea60 100644
--- a/synapse/third_party_rules/access_rules.py
+++ b/synapse/third_party_rules/access_rules.py
@@ -128,12 +128,11 @@ class RoomAccessRules(object):
             # rule, the access rule must be "restricted"). We don't need to check that if
             # there's no access rule provided, as in this case the access rule will
             # default to "restricted", with which any join rule is allowed.
-            if join_rule == JoinRules.PUBLIC and access_rule != ACCESS_RULE_RESTRICTED:
-                raise SynapseError(400, "Invalid access rule")
-
             if (
-                preset == RoomCreationPreset.PUBLIC_CHAT
-                and access_rule != ACCESS_RULE_RESTRICTED
+                (
+                    join_rule == JoinRules.PUBLIC
+                    or preset == RoomCreationPreset.PUBLIC_CHAT
+                ) and access_rule != ACCESS_RULE_RESTRICTED
             ):
                 raise SynapseError(400, "Invalid access rule")
         else: