diff options
author | Patrick Cloke <clokep@users.noreply.github.com> | 2021-12-09 13:16:01 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-09 13:16:01 -0500 |
commit | 3b8872299aac25a7e3ee5a9e00564105aa6de237 (patch) | |
tree | 80cfc0e00093d60a421c9250fe2002c5d8268b16 /synapse/events/utils.py | |
parent | Additional type hints for the config module, part 2. (#11480) (diff) | |
download | synapse-3b8872299aac25a7e3ee5a9e00564105aa6de237.tar.xz |
Do not allow cross-room relations, per MSC2674. (#11516)
Diffstat (limited to 'synapse/events/utils.py')
-rw-r--r-- | synapse/events/utils.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/synapse/events/utils.py b/synapse/events/utils.py index 84ef69df67..3da432c1df 100644 --- a/synapse/events/utils.py +++ b/synapse/events/utils.py @@ -454,23 +454,26 @@ class EventClientSerializer: return event_id = event.event_id + room_id = event.room_id # The bundled aggregations to include. aggregations = {} - annotations = await self.store.get_aggregation_groups_for_event(event_id) + annotations = await self.store.get_aggregation_groups_for_event( + event_id, room_id + ) if annotations.chunk: aggregations[RelationTypes.ANNOTATION] = annotations.to_dict() references = await self.store.get_relations_for_event( - event_id, RelationTypes.REFERENCE, direction="f" + event_id, room_id, RelationTypes.REFERENCE, direction="f" ) if references.chunk: aggregations[RelationTypes.REFERENCE] = references.to_dict() edit = None if event.type == EventTypes.Message: - edit = await self.store.get_applicable_edit(event_id) + edit = await self.store.get_applicable_edit(event_id, room_id) if edit: # If there is an edit replace the content, preserving existing @@ -503,7 +506,7 @@ class EventClientSerializer: ( thread_count, latest_thread_event, - ) = await self.store.get_thread_summary(event_id) + ) = await self.store.get_thread_summary(event_id, room_id) if latest_thread_event: aggregations[RelationTypes.THREAD] = { # Don't bundle aggregations as this could recurse forever. |