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

Commit

Permalink
Merge pull request #460 from matrix-org/erikj/create_room_3pid_invite
Browse files Browse the repository at this point in the history
Support inviting 3pids in /createRoom
  • Loading branch information
erikjohnston committed Jan 5, 2016
2 parents 07c33ef + c3ea363 commit d74c4e9
Showing 1 changed file with 16 additions and 0 deletions.
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,
token_id=None,
txn_id=None,
)

result = {"room_id": room_id}

if room_alias:
Expand Down

0 comments on commit d74c4e9

Please sign in to comment.