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

Pass through user-supplied content in /join/$room_id #1039

Merged
merged 1 commit into from
Aug 23, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
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
14 changes: 12 additions & 2 deletions synapse/handlers/room_member.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,13 @@ def _local_membership_update(
prev_event_ids,
txn_id=None,
ratelimit=True,
content=None,
):
if content is None:
content = {}
msg_handler = self.hs.get_handlers().message_handler

content = {"membership": membership}
content["membership"] = membership
if requester.is_guest:
content["kind"] = "guest"

Expand Down Expand Up @@ -140,6 +143,7 @@ def update_membership(
remote_room_hosts=None,
third_party_signed=None,
ratelimit=True,
content=None,
):
key = (room_id,)

Expand All @@ -153,6 +157,7 @@ def update_membership(
remote_room_hosts=remote_room_hosts,
third_party_signed=third_party_signed,
ratelimit=ratelimit,
content=content,
)

defer.returnValue(result)
Expand All @@ -168,7 +173,11 @@ def _update_membership(
remote_room_hosts=None,
third_party_signed=None,
ratelimit=True,
content=None,
):
if content is None:
content = {}

effective_membership_state = action
if action in ["kick", "unban"]:
effective_membership_state = "leave"
Expand Down Expand Up @@ -218,7 +227,7 @@ def _update_membership(
if inviter and not self.hs.is_mine(inviter):
remote_room_hosts.append(inviter.domain)

content = {"membership": Membership.JOIN}
content["membership"] = Membership.JOIN

profile = self.hs.get_handlers().profile_handler
content["displayname"] = yield profile.get_displayname(target)
Expand Down Expand Up @@ -272,6 +281,7 @@ def _update_membership(
txn_id=txn_id,
ratelimit=ratelimit,
prev_event_ids=latest_event_ids,
content=content,
)

@defer.inlineCallbacks
Expand Down
1 change: 1 addition & 0 deletions synapse/rest/client/v1/room.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ def on_POST(self, request, room_identifier, txn_id=None):
action="join",
txn_id=txn_id,
remote_room_hosts=remote_room_hosts,
content=content,
third_party_signed=content.get("third_party_signed", None),
)

Expand Down