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

Commit

Permalink
Fix unread count failing on NULL values (#8270)
Browse files Browse the repository at this point in the history
Fix unread counts making sync fail if the value of the `unread_count`
column in `event_push_summary` is `None`.
  • Loading branch information
babolivier authored Sep 7, 2020
1 parent 0dae7d8 commit a55e270
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.d/8270.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add unread messages count to sync responses, as specified in [MSC2654](https://github.com/matrix-org/matrix-doc/pull/2654).
7 changes: 6 additions & 1 deletion synapse/storage/databases/main/event_push_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,12 @@ def _get_unread_counts_by_pos_txn(self, txn, room_id, user_id, stream_ordering):

if row:
notif_count += row[0]
unread_count += row[1]

if row[1] is not None:
# The unread_count column of event_push_summary is NULLable, so we need
# to make sure we don't try increasing the unread counts if it's NULL
# for this row.
unread_count += row[1]

return {
"notify_count": notif_count,
Expand Down

0 comments on commit a55e270

Please sign in to comment.