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

Commit

Permalink
Return thread receipts down sync.
Browse files Browse the repository at this point in the history
  • Loading branch information
clokep committed Jul 28, 2022
1 parent db7b281 commit 19e1455
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions synapse/storage/databases/main/receipts.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,14 @@ def f(txn: LoggingTransaction) -> List[Dict[str, Any]]:
"_get_linearized_receipts_for_rooms", f
)

# Map of room ID to a dictionary in the form that sync wants it.
#
# room ID -> dict of:
# type: str
# room_id: str
# content: event ID -> dict of:
# receipt type -> dict of:
# user ID -> data
results: JsonDict = {}
for row in txn_results:
# We want a single event per room, since we want to batch the
Expand All @@ -427,6 +435,8 @@ def f(txn: LoggingTransaction) -> List[Dict[str, Any]]:
receipt_type = event_entry.setdefault(row["receipt_type"], {})

receipt_type[row["user_id"]] = db_to_json(row["data"])
if row["thread_id"]:
receipt_type[row["user_id"]]["thread_id"] = row["thread_id"]

results = {
room_id: [results[room_id]] if room_id in results else []
Expand Down

0 comments on commit 19e1455

Please sign in to comment.