summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-03-17 16:07:35 +0000
committerErik Johnston <erik@matrix.org>2016-03-17 16:23:53 +0000
commit3bb3f02517acf776fa467b7b5a4802dd20c9a8c6 (patch)
tree4fbe7e43123a72748c4e8001384d8824be904f4c /synapse
parentMerge pull request #650 from matrix-org/dbkr/register_idempotent_with_username (diff)
downloadsynapse-3bb3f02517acf776fa467b7b5a4802dd20c9a8c6.tar.xz
Enable guest access for private rooms by default
Diffstat (limited to 'synapse')
-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 051468989f..f7163470a9 100644
--- a/synapse/handlers/room.py
+++ b/synapse/handlers/room.py
@@ -62,16 +62,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,
         },
     }
 
@@ -347,6 +350,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,