summary refs log tree commit diff
diff options
context:
space:
mode:
authorBrendan Abolivier <babolivier@matrix.org>2019-07-25 10:15:44 +0200
committerBrendan Abolivier <babolivier@matrix.org>2019-07-25 10:15:44 +0200
commit2526b79ce6923bcf681ecd846b718269833e5a7e (patch)
treeb123965189c6e4844bad4cb85acdc38772672c06
parentDoc (diff)
downloadsynapse-2526b79ce6923bcf681ecd846b718269833e5a7e.tar.xz
Merge ifs
-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: