diff --git a/changelog.d/17750.bugfix b/changelog.d/17750.bugfix new file mode 100644 index 00000000000..29ac56ceac9 --- /dev/null +++ b/changelog.d/17750.bugfix @@ -0,0 +1 @@ +Fix hierarchy returning 403 when room is accessible through federation. Contributed by Krishan (@kfiven). diff --git a/synapse/handlers/room_summary.py b/synapse/handlers/room_summary.py index 64f5bea014f..7ed67b7e043 100644 --- a/synapse/handlers/room_summary.py +++ b/synapse/handlers/room_summary.py @@ -198,8 +198,9 @@ async def _get_room_hierarchy( ) if not local_room: + destination = requested_room_id.split(":", 1)[-1] room_hierarchy = await self._summarize_remote_room_hierarchy( - _RoomQueueEntry(requested_room_id, ()), + _RoomQueueEntry(requested_room_id, [destination]), False, ) root_room_entry = room_hierarchy[0] @@ -240,7 +241,8 @@ async def _get_room_hierarchy( processed_rooms = set(pagination_session["processed_rooms"]) else: # The queue of rooms to process, the next room is last on the stack. - room_queue = [_RoomQueueEntry(requested_room_id, ())] + destination = requested_room_id.split(":", 1)[-1] + room_queue = [_RoomQueueEntry(requested_room_id, [destination])] # Rooms we have already processed. processed_rooms = set()