diff options
author | Patrick Cloke <clokep@users.noreply.github.com> | 2021-06-29 12:00:04 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-29 12:00:04 -0400 |
commit | f55836929d3c64f3f8d883d8f3643a88b6c9cbca (patch) | |
tree | d819f59c143015da275191b3500e7da3eb3031b6 /synapse | |
parent | Fix `populate_stream_ordering2` background job (#10267) (diff) | |
download | synapse-f55836929d3c64f3f8d883d8f3643a88b6c9cbca.tar.xz |
Do not recurse into non-spaces in the spaces summary. (#10256)
Previously m.child.room events in non-space rooms would be treated as part of the room graph, but this is no longer supported.
Diffstat (limited to 'synapse')
-rw-r--r-- | synapse/api/constants.py | 6 | ||||
-rw-r--r-- | synapse/handlers/space_summary.py | 11 |
2 files changed, 15 insertions, 2 deletions
diff --git a/synapse/api/constants.py b/synapse/api/constants.py index 414e4c019a..8363c2bb0f 100644 --- a/synapse/api/constants.py +++ b/synapse/api/constants.py @@ -201,6 +201,12 @@ class EventContentFields: ) +class RoomTypes: + """Understood values of the room_type field of m.room.create events.""" + + SPACE = "m.space" + + class RoomEncryptionAlgorithms: MEGOLM_V1_AES_SHA2 = "m.megolm.v1.aes-sha2" DEFAULT = MEGOLM_V1_AES_SHA2 diff --git a/synapse/handlers/space_summary.py b/synapse/handlers/space_summary.py index 17fc47ce16..266f369883 100644 --- a/synapse/handlers/space_summary.py +++ b/synapse/handlers/space_summary.py @@ -25,6 +25,7 @@ from synapse.api.constants import ( EventTypes, HistoryVisibility, Membership, + RoomTypes, ) from synapse.events import EventBase from synapse.events.utils import format_event_for_client_v2 @@ -318,7 +319,8 @@ class SpaceSummaryHandler: Returns: A tuple of: - An iterable of a single value of the room. + The room information, if the room should be returned to the + user. None, otherwise. An iterable of the sorted children events. This may be limited to a maximum size or may include all children. @@ -328,7 +330,11 @@ class SpaceSummaryHandler: room_entry = await self._build_room_entry(room_id) - # look for child rooms/spaces. + # If the room is not a space, return just the room information. + if room_entry.get("room_type") != RoomTypes.SPACE: + return room_entry, () + + # Otherwise, look for child rooms/spaces. child_events = await self._get_child_events(room_id) if suggested_only: @@ -348,6 +354,7 @@ class SpaceSummaryHandler: event_format=format_event_for_client_v2, ) ) + return room_entry, events_result async def _summarize_remote_room( |