0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-12-15 00:33:50 +01:00

Merge pull request #653 from matrix-org/erikj/preset_guest_join

Enable guest access for private rooms by default
This commit is contained in:
Erik Johnston 2016-12-05 17:47:14 +00:00 committed by GitHub
commit 9609c91e7d

View file

@ -44,16 +44,19 @@ class RoomCreationHandler(BaseHandler):
"join_rules": JoinRules.INVITE, "join_rules": JoinRules.INVITE,
"history_visibility": "shared", "history_visibility": "shared",
"original_invitees_have_ops": False, "original_invitees_have_ops": False,
"guest_can_join": True,
}, },
RoomCreationPreset.TRUSTED_PRIVATE_CHAT: { RoomCreationPreset.TRUSTED_PRIVATE_CHAT: {
"join_rules": JoinRules.INVITE, "join_rules": JoinRules.INVITE,
"history_visibility": "shared", "history_visibility": "shared",
"original_invitees_have_ops": True, "original_invitees_have_ops": True,
"guest_can_join": True,
}, },
RoomCreationPreset.PUBLIC_CHAT: { RoomCreationPreset.PUBLIC_CHAT: {
"join_rules": JoinRules.PUBLIC, "join_rules": JoinRules.PUBLIC,
"history_visibility": "shared", "history_visibility": "shared",
"original_invitees_have_ops": False, "original_invitees_have_ops": False,
"guest_can_join": False,
}, },
} }
@ -336,6 +339,13 @@ class RoomCreationHandler(BaseHandler):
content={"history_visibility": config["history_visibility"]} 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(): for (etype, state_key), content in initial_state.items():
yield send( yield send(
etype=etype, etype=etype,