Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Merge pull request #784 from matrix-org/markjh/receipts_fix
Browse files Browse the repository at this point in the history
Allow receipts for events we haven't seen in the db
  • Loading branch information
NegativeMjark committed May 13, 2016
2 parents 99b5a2e + b7381d5 commit a8affd6
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions synapse/storage/receipts.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,11 @@ def insert_linearized_receipt_txn(self, txn, room_id, receipt_type,
table="events",
retcols=["topological_ordering", "stream_ordering"],
keyvalues={"event_id": event_id},
allow_none=True
)
topological_ordering = int(res["topological_ordering"])
stream_ordering = int(res["stream_ordering"])

topological_ordering = int(res["topological_ordering"]) if res else None
stream_ordering = int(res["stream_ordering"]) if res else None

# We don't want to clobber receipts for more recent events, so we
# have to compare orderings of existing receipts
Expand All @@ -264,7 +266,7 @@ def insert_linearized_receipt_txn(self, txn, room_id, receipt_type,
txn.execute(sql, (room_id, receipt_type, user_id))
results = txn.fetchall()

if results:
if results and topological_ordering:
for to, so, _ in results:
if int(to) > topological_ordering:
return False
Expand Down Expand Up @@ -294,7 +296,7 @@ def insert_linearized_receipt_txn(self, txn, room_id, receipt_type,
}
)

if receipt_type == "m.read":
if receipt_type == "m.read" and topological_ordering:
self._remove_push_actions_before_txn(
txn,
room_id=room_id,
Expand Down

0 comments on commit a8affd6

Please sign in to comment.