Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Support inviting 3pids in /createRoom #460

Merged
merged 2 commits into from
Jan 5, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions synapse/handlers/room.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ def create_room(self, user_id, room_id, config):
except:
raise SynapseError(400, "Invalid user_id: %s" % (i,))

invite_3pid_list = config.get("invite_3pid", [])

is_public = config.get("visibility", None) == "public"

if room_id:
Expand Down Expand Up @@ -220,6 +222,20 @@ def create_room(self, user_id, room_id, config):
"content": {"membership": Membership.INVITE},
}, ratelimit=False)

for invite_3pid in invite_3pid_list:
id_server = invite_3pid["id_server"]
address = invite_3pid["address"]
medium = invite_3pid["medium"]
yield self.hs.get_handlers().room_member_handler.do_3pid_invite(
room_id,
user,
medium,
address,
id_server,
None,
None,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use named args here? So that I know what's being set to None

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will the do_3pid_invite be ratelimited?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use named args here? So that I know what's being set to None

Done.

Will the do_3pid_invite be ratelimited?

It just ends up calling create_and_send_event I think, so its probably fiiiiiiiiiine

)

result = {"room_id": room_id}

if room_alias:
Expand Down