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 #7716 from matrix-org/babolivier/unread_fix
Browse files Browse the repository at this point in the history
Fix unread counts in sync
  • Loading branch information
babolivier authored Jun 17, 2020
2 parents 3630825 + 5a5cf64 commit e35d44c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions changelog.d/7716.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add a per-room counter for unread messages in responses to `/sync` requests. Implements [MSC2625](https://github.com/matrix-org/matrix-doc/pull/2625).
2 changes: 1 addition & 1 deletion synapse/push/push_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def get_badge_count(store, user_id):
# We're populating this badge using the unread_count (instead of the
# notify_count) as this badge is the number of missed messages, not the
# number of missed notifications.
badge += 1 if notifs["unread_count"] else 0
badge += 1 if notifs.get("unread_count") else 0
return badge


Expand Down
2 changes: 1 addition & 1 deletion synapse/storage/data_stores/main/event_push_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def _get_unread_counts_by_receipt_txn(
txn.execute(sql, (room_id, last_read_event_id))
results = txn.fetchall()
if len(results) == 0:
return {"notify_count": 0, "highlight_count": 0}
return {"notify_count": 0, "highlight_count": 0, "unread_count": 0}

stream_ordering = results[0][0]

Expand Down

0 comments on commit e35d44c

Please sign in to comment.