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

Commit 041ee97

Browse files
authored
Unread counts fixes (#8254)
* Fixup `ALTER TABLE` database queries Make the new columns nullable, because doing otherwise can wedge a server with a big database, as setting a default value rewrites the table. * Switch back to using the notifications count in the push badge Clients are likely to be confused if we send a push but the badge count is the unread messages one, and not the notifications one. * Changelog
1 parent db7de4d commit 041ee97

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

changelog.d/8254.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add unread messages count to sync responses, as specified in [MSC2654](https://github.com/matrix-org/matrix-doc/pull/2654).

synapse/push/push_tools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ async def get_badge_count(store, user_id):
3636
)
3737
# return one badge count per conversation, as count per
3838
# message is so noisy as to be almost useless
39-
badge += 1 if notifs["unread_count"] else 0
39+
badge += 1 if notifs["notify_count"] else 0
4040
return badge
4141

4242

synapse/storage/databases/main/schema/delta/58/15unread_count.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919

2020
-- Add columns to event_push_actions and event_push_actions_staging to track unread
2121
-- messages and calculate unread counts.
22-
ALTER TABLE event_push_actions_staging ADD COLUMN unread SMALLINT NOT NULL DEFAULT 0;
23-
ALTER TABLE event_push_actions ADD COLUMN unread SMALLINT NOT NULL DEFAULT 0;
22+
ALTER TABLE event_push_actions_staging ADD COLUMN unread SMALLINT;
23+
ALTER TABLE event_push_actions ADD COLUMN unread SMALLINT;
2424

2525
-- Add column to event_push_summary
26-
ALTER TABLE event_push_summary ADD COLUMN unread_count BIGINT NOT NULL DEFAULT 0;
26+
ALTER TABLE event_push_summary ADD COLUMN unread_count BIGINT;

0 commit comments

Comments
 (0)