summary refs log tree commit diff
path: root/synapse/events/utils.py
diff options
context:
space:
mode:
authorPatrick Cloke <clokep@users.noreply.github.com>2021-11-30 11:33:33 -0500
committerGitHub <noreply@github.com>2021-11-30 11:33:33 -0500
commit379f2650cf875f50c59524147ec0e33cfd5ef60c (patch)
treed55df4d11062d77875088e84039bd6c7474b8287 /synapse/events/utils.py
parentFix `LruCache` corruption bug with a `size_callback` that can return 0 (#11454) (diff)
downloadsynapse-379f2650cf875f50c59524147ec0e33cfd5ef60c.tar.xz
Bundle relations of relations into the `/relations` result. (#11284)
Per updates to MSC2675 which now states that bundled
aggregations should be included from the `/relations`
endpoint.
Diffstat (limited to 'synapse/events/utils.py')
-rw-r--r--synapse/events/utils.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/synapse/events/utils.py b/synapse/events/utils.py
index e5967c995e..05219a9dd0 100644
--- a/synapse/events/utils.py
+++ b/synapse/events/utils.py
@@ -435,6 +435,14 @@ class EventClientSerializer:
             serialized_event: The serialized event which may be modified.
 
         """
+        # Do not bundle relations for an event which represents an edit or an
+        # annotation. It does not make sense for them to have related events.
+        relates_to = event.content.get("m.relates_to")
+        if isinstance(relates_to, (dict, frozendict)):
+            relation_type = relates_to.get("rel_type")
+            if relation_type in (RelationTypes.ANNOTATION, RelationTypes.REPLACE):
+                return
+
         event_id = event.event_id
 
         # The bundled relations to include.