Fix unread count failing on NULL values (#8270)

Fix unread counts making sync fail if the value of the `unread_count`
column in `event_push_summary` is `None`.
This commit is contained in:
Brendan Abolivier 2020-09-07 15:15:06 +01:00 committed by GitHub
parent 0dae7d80bf
commit a55e2707d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

1
changelog.d/8270.feature Normal file
View file

@ -0,0 +1 @@
Add unread messages count to sync responses, as specified in [MSC2654](https://github.com/matrix-org/matrix-doc/pull/2654).

View file

@ -177,7 +177,12 @@ class EventPushActionsWorkerStore(SQLBaseStore):
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,