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

Fix space hierarchy endpoint to match MSC #11667

Merged
merged 5 commits into from
Jan 5, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/11667.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix `/_matrix/client/v1/room/{roomId}/hierarchy` endpoint returning incorrect fields.
turt2live marked this conversation as resolved.
Show resolved Hide resolved
9 changes: 7 additions & 2 deletions synapse/handlers/room_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ async def get_space_summary(
# Before returning to the client, remove the allowed_room_ids
# and allowed_spaces keys.
room.pop("allowed_room_ids", None)
room.pop("allowed_spaces", None)
room.pop("allowed_spaces", None) # historical

rooms_result.append(room)
events.extend(room_entry.children_state_events)
Expand Down Expand Up @@ -981,19 +981,24 @@ async def _build_room_entry(self, room_id: str, for_federation: bool) -> JsonDic
current_state_ids[(EventTypes.Create, "")]
)

aliases = await self._store.get_aliases_for_room(room_id)

entry = {
"room_id": stats["room_id"],
"name": stats["name"],
"topic": stats["topic"],
"canonical_alias": stats["canonical_alias"],
"aliases": aliases,
turt2live marked this conversation as resolved.
Show resolved Hide resolved
"num_joined_members": stats["joined_members"],
"avatar_url": stats["avatar"],
# plural join_rules is a documentation error but kept for historical
# purposes. Should match /publicRooms.
"join_rules": stats["join_rules"],
"join_rule": stats["join_rules"],
"world_readable": (
stats["history_visibility"] == HistoryVisibility.WORLD_READABLE
),
"guest_can_join": stats["guest_access"] == "can_join",
"creation_ts": create_event.origin_server_ts,
"room_type": create_event.content.get(EventContentFields.ROOM_TYPE),
}

Expand Down