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

Commit

Permalink
Alter - return value of "create_room" module API method so that it do…
Browse files Browse the repository at this point in the history
…esn't

expose Synapse internals.

Modules shouldn't be concerned with Synapse internals.
  • Loading branch information
buffless-matt committed Aug 3, 2022
1 parent 8116429 commit 549b685
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions synapse/module_api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1458,7 +1458,7 @@ async def create_room(
config: JsonDict,
ratelimit: bool = True,
creator_join_profile: Optional[JsonDict] = None,
) -> Tuple[dict, int]:
) -> Tuple[str, Optional[str]]:
"""Creates a new room.
Added in Synapse v1.66.0.
Expand All @@ -1478,9 +1478,8 @@ async def create_room(
`avatar_url` and/or `displayname`.
Returns:
First, a dict containing the keys `room_id` and, if an alias
was, requested, `room_alias`. Secondly, the stream_id of the
last persisted event.
A tuple containing the room ID (str) and, if an alias was requested,
the room alias (str), otherwise None (if no alias was requested).
Raises:
SynapseError if the user_id is invalid, room ID couldn't be stored, or
something went horribly wrong.
Expand All @@ -1494,14 +1493,15 @@ async def create_room(
)

requester = create_requester(user_id)

return await self._hs.get_room_creation_handler().create_room(
room_id_and_alias, _ = await self._hs.get_room_creation_handler().create_room(
requester=requester,
config=config,
ratelimit=ratelimit,
creator_join_profile=creator_join_profile,
)

return room_id_and_alias["room_id"], room_id_and_alias.get("room_alias", None)


class PublicRoomListManager:
"""Contains methods for adding to, removing from and querying whether a room
Expand Down

0 comments on commit 549b685

Please sign in to comment.