summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2016-07-26 11:05:39 +0100
committerMark Haines <mark.haines@matrix.org>2016-07-26 11:05:39 +0100
commita6f06ce3e280cfa18f51748a7d4327001658db40 (patch)
treef1db3785548fa00e6f23134c43fba7a7a39e60c9 /synapse/storage
parentDon't add rejected events if we've seen them befrore. Add some comments to ex... (diff)
downloadsynapse-a6f06ce3e280cfa18f51748a7d4327001658db40.tar.xz
Fix how push_actions are redacted.
Diffstat (limited to 'synapse/storage')
-rw-r--r--synapse/storage/events.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/synapse/storage/events.py b/synapse/storage/events.py
index 25a2be2795..c63ca36df6 100644
--- a/synapse/storage/events.py
+++ b/synapse/storage/events.py
@@ -522,6 +522,8 @@ class EventsStore(SQLBaseStore):
         ]
 
         if not events_and_contexts:
+            # Make sure we don't pass an empty list to functions that expect to
+            # be storing at least one element.
             return
 
         # From this point onwards the events are only events that we haven't
@@ -608,6 +610,13 @@ class EventsStore(SQLBaseStore):
                     txn, event, context.push_actions
                 )
 
+            if event.type == EventTypes.Redaction and event.redacts is not None:
+                # Remove the entries in the event_push_actions table for the
+                # redacted event.
+                self._remove_push_actions_for_event_id_txn(
+                    txn, event.room_id, event.redacts
+                )
+
         self._simple_insert_many_txn(
             txn,
             table="event_auth",
@@ -622,13 +631,6 @@ class EventsStore(SQLBaseStore):
             ],
         )
 
-        if event.type == EventTypes.Redaction and event.redacts is not None:
-            # Remove the entries in the event_push_actions table for the
-            # redacted event.
-            self._remove_push_actions_for_event_id_txn(
-                txn, event.room_id, event.redacts
-            )
-
         # Insert into the state_groups, state_groups_state, and
         # event_to_state_groups tables.
         self._store_mult_state_groups_txn(txn, events_and_contexts)
@@ -716,7 +718,7 @@ class EventsStore(SQLBaseStore):
             ],
         )
 
-        # Prefil the event cache
+        # Prefill the event cache
         self._add_to_cache(txn, events_and_contexts)
 
         if backfilled: