Skip to content

Commit

Permalink
Stabilise MSC4156: server_name -> via (#17650)
Browse files Browse the repository at this point in the history
  • Loading branch information
Johennes authored Sep 5, 2024
1 parent 6b770d8 commit de3363e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 19 deletions.
1 change: 1 addition & 0 deletions changelog.d/17650.removal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Stabilise [MSC4156](https://github.com/matrix-org/matrix-spec-proposals/pull/4156) by removing the `msc4156_enabled` config setting and defaulting it to `true`.
3 changes: 0 additions & 3 deletions synapse/config/experimental.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,3 @@ def read_config(self, config: JsonDict, **kwargs: Any) -> None:

# MSC4151: Report room API (Client-Server API)
self.msc4151_enabled: bool = experimental.get("msc4151_enabled", False)

# MSC4156: Migrate server_name to via
self.msc4156_enabled: bool = experimental.get("msc4156_enabled", False)
13 changes: 4 additions & 9 deletions synapse/rest/client/knock.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ def __init__(self, hs: "HomeServer"):
super().__init__()
self.room_member_handler = hs.get_room_member_handler()
self.auth = hs.get_auth()
self._support_via = hs.config.experimental.msc4156_enabled

async def on_POST(
self,
Expand All @@ -72,15 +71,11 @@ async def on_POST(

# twisted.web.server.Request.args is incorrectly defined as Optional[Any]
args: Dict[bytes, List[bytes]] = request.args # type: ignore
remote_room_hosts = parse_strings_from_args(
args, "server_name", required=False
)
if self._support_via:
# Prefer via over server_name (deprecated with MSC4156)
remote_room_hosts = parse_strings_from_args(args, "via", required=False)
if remote_room_hosts is None:
remote_room_hosts = parse_strings_from_args(
args,
"org.matrix.msc4156.via",
default=remote_room_hosts,
required=False,
args, "server_name", required=False
)
elif RoomAlias.is_valid(room_identifier):
handler = self.room_member_handler
Expand Down
11 changes: 4 additions & 7 deletions synapse/rest/client/room.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,6 @@ def __init__(self, hs: "HomeServer"):
super().__init__(hs)
super(ResolveRoomIdMixin, self).__init__(hs) # ensure the Mixin is set up
self.auth = hs.get_auth()
self._support_via = hs.config.experimental.msc4156_enabled

def register(self, http_server: HttpServer) -> None:
# /join/$room_identifier[/$txn_id]
Expand All @@ -437,13 +436,11 @@ async def _do(

# twisted.web.server.Request.args is incorrectly defined as Optional[Any]
args: Dict[bytes, List[bytes]] = request.args # type: ignore
remote_room_hosts = parse_strings_from_args(args, "server_name", required=False)
if self._support_via:
# Prefer via over server_name (deprecated with MSC4156)
remote_room_hosts = parse_strings_from_args(args, "via", required=False)
if remote_room_hosts is None:
remote_room_hosts = parse_strings_from_args(
args,
"org.matrix.msc4156.via",
default=remote_room_hosts,
required=False,
args, "server_name", required=False
)
room_id, remote_room_hosts = await self.resolve_room_id(
room_identifier,
Expand Down

0 comments on commit de3363e

Please sign in to comment.