diff options
author | Erik Johnston <erik@matrix.org> | 2015-07-08 10:54:01 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2015-07-08 11:02:04 +0100 |
commit | 87311d1b8cc648400dfce5db8a7fed46abbeb963 (patch) | |
tree | cd3ef2c36c70eaaf92203ae57d0489f5674209bc /synapse/storage/receipts.py | |
parent | Fix test. (diff) | |
download | synapse-87311d1b8cc648400dfce5db8a7fed46abbeb963.tar.xz |
Hook up receipts to v1 initialSync
Diffstat (limited to '')
-rw-r--r-- | synapse/storage/receipts.py | 29 |
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) |