From dd4778875213d9cb8be7ee71d32751fbd6cdaba2 Mon Sep 17 00:00:00 2001 From: Patrick Cloke Date: Mon, 20 Dec 2021 14:14:38 -0500 Subject: Do not bundle aggregations for APIs which shouldn't include them. (#11592) And make bundling aggregations opt-in, instead of opt-out to avoid having APIs to include extraneous data (and being much heavier than necessary). --- synapse/rest/client/room.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'synapse/rest/client/room.py') diff --git a/synapse/rest/client/room.py b/synapse/rest/client/room.py index 60719331b6..40330749e5 100644 --- a/synapse/rest/client/room.py +++ b/synapse/rest/client/room.py @@ -662,7 +662,9 @@ class RoomEventServlet(RestServlet): time_now = self.clock.time_msec() if event: - event_dict = await self._event_serializer.serialize_event(event, time_now) + event_dict = await self._event_serializer.serialize_event( + event, time_now, bundle_aggregations=True + ) return 200, event_dict raise SynapseError(404, "Event not found.", errcode=Codes.NOT_FOUND) @@ -707,13 +709,13 @@ class RoomEventContextServlet(RestServlet): time_now = self.clock.time_msec() results["events_before"] = await self._event_serializer.serialize_events( - results["events_before"], time_now + results["events_before"], time_now, bundle_aggregations=True ) results["event"] = await self._event_serializer.serialize_event( - results["event"], time_now + results["event"], time_now, bundle_aggregations=True ) results["events_after"] = await self._event_serializer.serialize_events( - results["events_after"], time_now + results["events_after"], time_now, bundle_aggregations=True ) results["state"] = await self._event_serializer.serialize_events( results["state"], time_now -- cgit 1.4.1