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

Commit

Permalink
Remove experimental configuration flag for MSC3666. (#12436)
Browse files Browse the repository at this point in the history
  • Loading branch information
clokep authored Apr 11, 2022
1 parent 4586119 commit ab3165e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 19 deletions.
2 changes: 2 additions & 0 deletions changelog.d/12436.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Include bundled aggregations in search results
([MSC3666](https://github.com/matrix-org/matrix-spec-proposals/pull/3666)).
2 changes: 0 additions & 2 deletions synapse/config/experimental.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ def read_config(self, config: JsonDict, **kwargs: Any) -> None:

# MSC3440 (thread relation)
self.msc3440_enabled: bool = experimental.get("msc3440_enabled", False)
# MSC3666: including bundled relations in /search.
self.msc3666_enabled: bool = experimental.get("msc3666_enabled", False)

# MSC3026 (busy presence state)
self.msc3026_enabled: bool = experimental.get("msc3026_enabled", False)
Expand Down
30 changes: 13 additions & 17 deletions synapse/handlers/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ def __init__(self, hs: "HomeServer"):
self.state_store = self.storage.state
self.auth = hs.get_auth()

self._msc3666_enabled = hs.config.experimental.msc3666_enabled

async def get_old_rooms_from_upgraded_room(self, room_id: str) -> Iterable[str]:
"""Retrieves room IDs of old rooms in the history of an upgraded room.
Expand Down Expand Up @@ -353,22 +351,20 @@ async def _search(
state = await self.state_handler.get_current_state(room_id)
state_results[room_id] = list(state.values())

aggregations = None
if self._msc3666_enabled:
aggregations = await self._relations_handler.get_bundled_aggregations(
# Generate an iterable of EventBase for all the events that will be
# returned, including contextual events.
itertools.chain(
# The events_before and events_after for each context.
itertools.chain.from_iterable(
itertools.chain(context["events_before"], context["events_after"]) # type: ignore[arg-type]
for context in contexts.values()
),
# The returned events.
search_result.allowed_events,
aggregations = await self._relations_handler.get_bundled_aggregations(
# Generate an iterable of EventBase for all the events that will be
# returned, including contextual events.
itertools.chain(
# The events_before and events_after for each context.
itertools.chain.from_iterable(
itertools.chain(context["events_before"], context["events_after"]) # type: ignore[arg-type]
for context in contexts.values()
),
user.to_string(),
)
# The returned events.
search_result.allowed_events,
),
user.to_string(),
)

# We're now about to serialize the events. We should not make any
# blocking calls after this. Otherwise, the 'age' will be wrong.
Expand Down

0 comments on commit ab3165e

Please sign in to comment.