summary refs log tree commit diff
path: root/synapse/handlers/room.py
diff options
context:
space:
mode:
authorErik Johnston <erikj@jki.re>2016-12-05 17:47:14 +0000
committerGitHub <noreply@github.com>2016-12-05 17:47:14 +0000
commit9609c91e7d4e73c1d1e8af9af23cf10aa177dcb3 (patch)
treeca3cf19af0bf228b2ed9c5fbb768185ac045afc1 /synapse/handlers/room.py
parentMerge pull request #1649 from matrix-org/dbkr/log_ui_auth_args (diff)
parentEnable guest access for private rooms by default (diff)
downloadsynapse-9609c91e7d4e73c1d1e8af9af23cf10aa177dcb3.tar.xz
Merge pull request #653 from matrix-org/erikj/preset_guest_join
Enable guest access for private rooms by default
Diffstat (limited to 'synapse/handlers/room.py')
-rw-r--r--synapse/handlers/room.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/synapse/handlers/room.py b/synapse/handlers/room.py
index 59e4d1cd15..5f18007e90 100644
--- a/synapse/handlers/room.py
+++ b/synapse/handlers/room.py
@@ -44,16 +44,19 @@ class RoomCreationHandler(BaseHandler):
             "join_rules": JoinRules.INVITE,
             "history_visibility": "shared",
             "original_invitees_have_ops": False,
+            "guest_can_join": True,
         },
         RoomCreationPreset.TRUSTED_PRIVATE_CHAT: {
             "join_rules": JoinRules.INVITE,
             "history_visibility": "shared",
             "original_invitees_have_ops": True,
+            "guest_can_join": True,
         },
         RoomCreationPreset.PUBLIC_CHAT: {
             "join_rules": JoinRules.PUBLIC,
             "history_visibility": "shared",
             "original_invitees_have_ops": False,
+            "guest_can_join": False,
         },
     }
 
@@ -336,6 +339,13 @@ class RoomCreationHandler(BaseHandler):
                 content={"history_visibility": config["history_visibility"]}
             )
 
+        if config["guest_can_join"]:
+            if (EventTypes.GuestAccess, '') not in initial_state:
+                yield send(
+                    etype=EventTypes.GuestAccess,
+                    content={"guest_access": "can_join"}
+                )
+
         for (etype, state_key), content in initial_state.items():
             yield send(
                 etype=etype,