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

Commit f281714

Browse files
Don't bundle aggregations when retrieving the original event (#5654)
A fix for PR #5626, which returned the original event content as part of a call to /relations. Only problem was that we were attempting to aggregate the relations on top of it when we did so. We now set bundle_aggregations to False in the get_event call. We also do this when pulling the relation events as well, because edits of edits are not something we'd like to support here.
1 parent 3dd61d1 commit f281714

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

changelog.d/5654.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix bug in #5626 that prevented the original_event field from actually having the contents of the original event in a call to `/relations`.

synapse/rest/client/v2_alpha/relations.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,18 @@ def on_GET(self, request, room_id, parent_id, relation_type=None, event_type=Non
173173
)
174174

175175
now = self.clock.time_msec()
176-
original_event = yield self._event_serializer.serialize_event(event, now)
177-
events = yield self._event_serializer.serialize_events(events, now)
176+
# We set bundle_aggregations to False when retrieving the original
177+
# event because we want the content before relations were applied to
178+
# it.
179+
original_event = yield self._event_serializer.serialize_event(
180+
event, now, bundle_aggregations=False
181+
)
182+
# Similarly, we don't allow relations to be applied to relations, so we
183+
# return the original relations without any aggregations on top of them
184+
# here.
185+
events = yield self._event_serializer.serialize_events(
186+
events, now, bundle_aggregations=False
187+
)
178188

179189
return_value = result.to_dict()
180190
return_value["chunk"] = events

0 commit comments

Comments
 (0)