summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2014-09-24 14:18:08 +0100
committerErik Johnston <erik@matrix.org>2014-09-24 14:18:08 +0100
commit7d9a84a445729e94b5f5aa445965b4e164442c7c (patch)
treee2bb31bfa2d1bad4b12c5e7a633793f994ff2956 /synapse
parentFix bug where we didn't correctly pull out the event_id of the deletion (diff)
downloadsynapse-7d9a84a445729e94b5f5aa445965b4e164442c7c.tar.xz
Make deleting deletes not undelete
Diffstat (limited to '')
-rw-r--r--synapse/storage/__init__.py18
1 files changed, 4 insertions, 14 deletions
diff --git a/synapse/storage/__init__.py b/synapse/storage/__init__.py
index 0d57073aa4..accb4359bd 100644
--- a/synapse/storage/__init__.py
+++ b/synapse/storage/__init__.py
@@ -246,20 +246,10 @@ class DataStore(RoomMemberStore, RoomStore,
             )
 
     def _store_deletion(self, txn, event):
-        event_id = event.event_id
-        deletes = event.deletes
-
-        # We check if this new delete deletes an old delete or has been
-        # deleted by a previous delete that we received out of order.
-        sql = "SELECT * FROM deletions WHERE event_id = ? OR deletes = ?"
-        txn.execute(sql, (deletes, event_id))
-
-        if txn.fetchall():
-            sql = "DELETE FROM deletions WHERE event_id = ? OR deletes = ?"
-            txn.execute(sql, (deletes, event_id, ))
-        else:
-            sql = "INSERT INTO deletions (event_id, deletes) VALUES (?,?)"
-            txn.execute(sql, (event_id, deletes))
+        txn.execute(
+            "INSERT INTO deletions (event_id, deletes) VALUES (?,?) OR IGNORE",
+            (event.event_id, event.deletes)
+        )
 
     @defer.inlineCallbacks
     def get_current_state(self, room_id, event_type=None, state_key=""):