summary refs log tree commit diff
diff options
context:
space:
mode:
authorPatrick Cloke <clokep@users.noreply.github.com>2022-04-11 15:37:46 -0400
committerGitHub <noreply@github.com>2022-04-11 15:37:46 -0400
commitab3165efb77e670da807977f0cb227217649aa44 (patch)
treee39cc1ba208ab9750ea5e3924506a13c2884ec0d
parentAdd missing type hints to config classes. (#12402) (diff)
downloadsynapse-ab3165efb77e670da807977f0cb227217649aa44.tar.xz
Remove experimental configuration flag for MSC3666. (#12436)
Diffstat (limited to '')
-rw-r--r--changelog.d/12436.feature2
-rw-r--r--synapse/config/experimental.py2
-rw-r--r--synapse/handlers/search.py30
3 files changed, 15 insertions, 19 deletions
diff --git a/changelog.d/12436.feature b/changelog.d/12436.feature
new file mode 100644
index 0000000000..883ac15574
--- /dev/null
+++ b/changelog.d/12436.feature
@@ -0,0 +1,2 @@
+Include bundled aggregations in search results 
+([MSC3666](https://github.com/matrix-org/matrix-spec-proposals/pull/3666)).
diff --git a/synapse/config/experimental.py b/synapse/config/experimental.py
index 0dd4c59581..447476fbfa 100644
--- a/synapse/config/experimental.py
+++ b/synapse/config/experimental.py
@@ -28,8 +28,6 @@ class ExperimentalConfig(Config):
 
         # 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)
diff --git a/synapse/handlers/search.py b/synapse/handlers/search.py
index 30eddda65f..102dd4b57d 100644
--- a/synapse/handlers/search.py
+++ b/synapse/handlers/search.py
@@ -59,8 +59,6 @@ class SearchHandler:
         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.
 
@@ -353,22 +351,20 @@ class SearchHandler:
                 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.