summary refs log tree commit diff
path: root/synapse/handlers/event_auth.py
diff options
context:
space:
mode:
authorTravis Ralston <travisr@matrix.org>2022-05-17 04:41:39 -0600
committerGitHub <noreply@github.com>2022-05-17 10:41:39 +0000
commit942c30b16b86cb05d2109b13bc2c1dc9ac2fea70 (patch)
tree97e56aa03d4cef7b05e8c5adc5f41f2af0d9ebfe /synapse/handlers/event_auth.py
parentRemove code which updates `application_services_state.last_txn` (#12680) (diff)
downloadsynapse-942c30b16b86cb05d2109b13bc2c1dc9ac2fea70.tar.xz
Add a new room version for MSC3787's knock+restricted join rule (#12623)
Diffstat (limited to 'synapse/handlers/event_auth.py')
-rw-r--r--synapse/handlers/event_auth.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/synapse/handlers/event_auth.py b/synapse/handlers/event_auth.py
index d441ebb0ab..6bed464351 100644
--- a/synapse/handlers/event_auth.py
+++ b/synapse/handlers/event_auth.py
@@ -241,7 +241,15 @@ class EventAuthHandler:
 
         # 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.RESTRICTED
+        content_join_rule = join_rules_event.content.get("join_rule")
+        if content_join_rule == JoinRules.RESTRICTED:
+            return True
+
+        # also check for MSC3787 behaviour
+        if room_version.msc3787_knock_restricted_join_rule:
+            return content_join_rule == JoinRules.KNOCK_RESTRICTED
+
+        return False
 
     async def get_rooms_that_allow_join(
         self, state_ids: StateMap[str]