Fix a bug that corrupted the cache of federated space hierarchies (#11775)

`FederationClient.get_room_hierarchy()` caches its return values, so
refactor the code to avoid modifying the returned room summary.
This commit is contained in:
Sean Quah 2022-01-20 11:03:42 +00:00 committed by GitHub
parent 5572e6cc4b
commit af13a3be29
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 102 additions and 12 deletions

View file

@ -780,6 +780,7 @@ class RoomSummaryHandler:
try:
(
room_response,
children_state_events,
children,
inaccessible_children,
) = await self._federation_client.get_room_hierarchy(
@ -804,7 +805,7 @@ class RoomSummaryHandler:
}
return (
_RoomEntry(room_id, room_response, room_response.pop("children_state", ())),
_RoomEntry(room_id, room_response, children_state_events),
children_by_room_id,
set(inaccessible_children),
)