mirror of
https://github.com/element-hq/synapse
synced 2024-08-20 09:40:22 +00:00
Pass through user-supplied content in /join/$room_id
It was always intended to allow custom keys on the join event, but this has at some point been lost. Restore it. If the user specifies keys like "avatar_url" then they will be clobbered.
This commit is contained in:
parent
122c7a43c9
commit
4b31426a02
2 changed files with 13 additions and 2 deletions
|
@ -59,10 +59,13 @@ class RoomMemberHandler(BaseHandler):
|
|||
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"
|
||||
|
||||
|
@ -140,6 +143,7 @@ class RoomMemberHandler(BaseHandler):
|
|||
remote_room_hosts=None,
|
||||
third_party_signed=None,
|
||||
ratelimit=True,
|
||||
content=None,
|
||||
):
|
||||
key = (room_id,)
|
||||
|
||||
|
@ -153,6 +157,7 @@ class RoomMemberHandler(BaseHandler):
|
|||
remote_room_hosts=remote_room_hosts,
|
||||
third_party_signed=third_party_signed,
|
||||
ratelimit=ratelimit,
|
||||
content=content,
|
||||
)
|
||||
|
||||
defer.returnValue(result)
|
||||
|
@ -168,7 +173,11 @@ class RoomMemberHandler(BaseHandler):
|
|||
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"
|
||||
|
@ -218,7 +227,7 @@ class RoomMemberHandler(BaseHandler):
|
|||
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)
|
||||
|
@ -272,6 +281,7 @@ class RoomMemberHandler(BaseHandler):
|
|||
txn_id=txn_id,
|
||||
ratelimit=ratelimit,
|
||||
prev_event_ids=latest_event_ids,
|
||||
content=content,
|
||||
)
|
||||
|
||||
@defer.inlineCallbacks
|
||||
|
|
|
@ -268,6 +268,7 @@ class JoinRoomAliasServlet(ClientV1RestServlet):
|
|||
action="join",
|
||||
txn_id=txn_id,
|
||||
remote_room_hosts=remote_room_hosts,
|
||||
content=content,
|
||||
third_party_signed=content.get("third_party_signed", None),
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in a new issue