summary refs log tree commit diff
path: root/synapse/storage/relations.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2019-05-20 10:13:05 +0100
committerErik Johnston <erik@matrix.org>2019-05-20 12:09:27 +0100
commit935af0da380f39ba284b78054270331bdbad7712 (patch)
treeb11a1f1cd2a8d6aad79970f7e8c33a7a69909411 /synapse/storage/relations.py
parentMake tests use different user for each reaction it sends (diff)
downloadsynapse-935af0da380f39ba284b78054270331bdbad7712.tar.xz
Correctly update aggregation counts after redaction
Diffstat (limited to 'synapse/storage/relations.py')
-rw-r--r--synapse/storage/relations.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/synapse/storage/relations.py b/synapse/storage/relations.py
index 6e216066ab..63e6185ee3 100644
--- a/synapse/storage/relations.py
+++ b/synapse/storage/relations.py
@@ -415,3 +415,20 @@ class RelationsStore(RelationsWorkerStore):
 
         if rel_type == RelationTypes.REPLACES:
             txn.call_after(self.get_applicable_edit.invalidate, (parent_id,))
+
+    def _handle_redaction(self, txn, redacted_event_id):
+        """Handles receiving a redaction and checking whether we need to remove
+        any redacted relations from the database.
+
+        Args:
+            txn
+            redacted_event_id (str): The event that was redacted.
+        """
+
+        self._simple_delete_txn(
+            txn,
+            table="event_relations",
+            keyvalues={
+                "event_id": redacted_event_id,
+            }
+        )