summary refs log tree commit diff
path: root/synapse/storage/receipts.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-07-08 10:54:01 +0100
committerErik Johnston <erik@matrix.org>2015-07-08 11:02:04 +0100
commit87311d1b8cc648400dfce5db8a7fed46abbeb963 (patch)
treecd3ef2c36c70eaaf92203ae57d0489f5674209bc /synapse/storage/receipts.py
parentFix test. (diff)
downloadsynapse-87311d1b8cc648400dfce5db8a7fed46abbeb963.tar.xz
Hook up receipts to v1 initialSync
Diffstat (limited to '')
-rw-r--r--synapse/storage/receipts.py29
1 files changed, 20 insertions, 9 deletions
diff --git a/synapse/storage/receipts.py b/synapse/storage/receipts.py
index 5a02c80252..07f8edaace 100644
--- a/synapse/storage/receipts.py
+++ b/synapse/storage/receipts.py
@@ -28,15 +28,26 @@ class ReceiptsStore(SQLBaseStore):
     @defer.inlineCallbacks
     def get_linearized_receipts_for_room(self, room_id, from_key, to_key):
         def f(txn):
-            sql = (
-                "SELECT * FROM receipts_linearized WHERE"
-                " room_id = ? AND stream_id > ? AND stream_id <= ?"
-            )
-
-            txn.execute(
-                sql,
-                (room_id, from_key, to_key)
-            )
+            if from_key:
+                sql = (
+                    "SELECT * FROM receipts_linearized WHERE"
+                    " room_id = ? AND stream_id > ? AND stream_id <= ?"
+                )
+
+                txn.execute(
+                    sql,
+                    (room_id, from_key, to_key)
+                )
+            else:
+                sql = (
+                    "SELECT * FROM receipts_linearized WHERE"
+                    " room_id = ? AND stream_id <= ?"
+                )
+
+                txn.execute(
+                    sql,
+                    (room_id, to_key)
+                )
 
             rows = self.cursor_to_dict(txn)