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

Commit

Permalink
Alter - approach to feed through "remote_room_hosts" parameter.
Browse files Browse the repository at this point in the history
  • Loading branch information
buffless-matt committed Aug 4, 2022
1 parent e6ada9d commit 216dd62
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions synapse/module_api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@
JsonMapping,
Requester,
RoomAlias,
RoomID,
StateMap,
UserID,
UserInfo,
Expand Down Expand Up @@ -930,7 +929,7 @@ async def update_room_membership(
room_id: str,
new_membership: str,
content: Optional[JsonDict] = None,
is_remote_join: bool = False,
remote_room_hosts: Optional[List[str]] = None,
) -> EventBase:
"""Updates the membership of a user to the given value.
Expand All @@ -948,9 +947,7 @@ async def update_room_membership(
https://spec.matrix.org/unstable/client-server-api/#mroommember for the
list of allowed values.
content: Additional values to include in the resulting event's content.
is_remote_join: Must be True if room_id refers to a remote room and
new_membership is "join" (i.e. a remote join is needed), otherwise must
be False.
remote_room_hosts: Remote servers to send the update to.
Returns:
The newly created membership event.
Expand Down Expand Up @@ -1004,17 +1001,13 @@ async def update_room_membership(
if "displayname" not in content:
content["displayname"] = profile["displayname"]

remote_room_hosts = None
if is_remote_join:
remote_room_hosts = [RoomID.from_string(room_id).domain]

event_id, _ = await self._hs.get_room_member_handler().update_membership(
requester=requester,
target=target_user_id,
room_id=room_id,
action=new_membership,
remote_room_hosts=remote_room_hosts,
content=content,
remote_room_hosts=remote_room_hosts,
)

# Try to retrieve the resulting event.
Expand Down

0 comments on commit 216dd62

Please sign in to comment.