Skip to content

Commit e5d292b

Browse files
committed
Pass the remote_room_hosts as a list instead of a tuple.
1 parent 53e7be8 commit e5d292b

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

synapse/handlers/room_summary.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def __init__(self, hs: "HomeServer"):
118118
Optional[int],
119119
Optional[int],
120120
Optional[str],
121-
Optional[Tuple[str, ...]],
121+
Optional[List[str]],
122122
]
123123
] = ResponseCache(
124124
hs.get_clock(),
@@ -134,7 +134,7 @@ async def get_room_hierarchy(
134134
max_depth: Optional[int] = None,
135135
limit: Optional[int] = None,
136136
from_token: Optional[str] = None,
137-
remote_room_hosts: Optional[Tuple[str, ...]] = None,
137+
remote_room_hosts: Optional[List[str]] = None,
138138
) -> JsonDict:
139139
"""
140140
Implementation of the room hierarchy C-S API.
@@ -191,7 +191,7 @@ async def _get_room_hierarchy(
191191
max_depth: Optional[int] = None,
192192
limit: Optional[int] = None,
193193
from_token: Optional[str] = None,
194-
remote_room_hosts: Optional[Tuple[str, ...]] = None,
194+
remote_room_hosts: Optional[List[str]] = None,
195195
) -> JsonDict:
196196
"""See docstring for SpaceSummaryHandler.get_room_hierarchy."""
197197

@@ -211,7 +211,7 @@ async def _get_room_hierarchy(
211211

212212
if not local_room:
213213
room_hierarchy = await self._summarize_remote_room_hierarchy(
214-
_RoomQueueEntry(requested_room_id, remote_room_hosts or ()),
214+
_RoomQueueEntry(requested_room_id, remote_room_hosts or []),
215215
False,
216216
)
217217
root_room_entry = room_hierarchy[0]
@@ -252,7 +252,7 @@ async def _get_room_hierarchy(
252252
processed_rooms = set(pagination_session["processed_rooms"])
253253
else:
254254
# The queue of rooms to process, the next room is last on the stack.
255-
room_queue = [_RoomQueueEntry(requested_room_id, remote_room_hosts or ())]
255+
room_queue = [_RoomQueueEntry(requested_room_id, remote_room_hosts or [])]
256256

257257
# Rooms we have already processed.
258258
processed_rooms = set()

synapse/rest/client/room.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1527,14 +1527,13 @@ async def on_GET(
15271527
max_depth = parse_integer(request, "max_depth")
15281528
limit = parse_integer(request, "limit")
15291529

1530-
# twisted.web.server.Request.args is incorrectly defined as Optional[Any]
15311530
remote_room_hosts = None
15321531
if self.msc4235_enabled:
1532+
# twisted.web.server.Request.args is incorrectly defined as Optional[Any]
15331533
args: Dict[bytes, List[bytes]] = request.args # type: ignore
1534-
via_param = parse_strings_from_args(
1534+
remote_room_hosts = parse_strings_from_args(
15351535
args, "org.matrix.msc4235.via", required=False
15361536
)
1537-
remote_room_hosts = tuple(via_param or [])
15381537

15391538
return 200, await self._room_summary_handler.get_room_hierarchy(
15401539
requester,

tests/handlers/test_room_summary.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1088,7 +1088,7 @@ def test_fed_remote_room_hosts(self) -> None:
10881088
fed_space = "#fed_space:" + fed_hostname
10891089
fed_subroom = "#fed_sub_room:" + fed_hostname
10901090

1091-
remote_room_hosts = tuple(fed_hostname)
1091+
remote_room_hosts = [fed_hostname]
10921092

10931093
requested_room_entry = _RoomEntry(
10941094
fed_space,

0 commit comments

Comments
 (0)