Browse Source

Fix notification count after a highlighted message (#13223)

Fixes #13196

Broke by #13005
tags/v1.63.0rc1
Erik Johnston 1 year ago
committed by GitHub
parent
commit
757bc0caef
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 3 deletions
  1. +1
    -0
      changelog.d/13223.bugfix
  2. +8
    -3
      synapse/storage/databases/main/event_push_actions.py
  3. +7
    -0
      tests/storage/test_event_push_actions.py

+ 1
- 0
changelog.d/13223.bugfix View File

@@ -0,0 +1 @@
Fix bug where notification counts would get stuck after a highlighted message. Broke in v1.62.0.

+ 8
- 3
synapse/storage/databases/main/event_push_actions.py View File

@@ -1016,9 +1016,14 @@ class EventPushActionsWorkerStore(ReceiptsWorkerStore, StreamWorkerStore, SQLBas
upd.stream_ordering
FROM (
SELECT user_id, room_id, count(*) as cnt,
max(stream_ordering) as stream_ordering
FROM event_push_actions
WHERE ? < stream_ordering AND stream_ordering <= ?
max(ea.stream_ordering) as stream_ordering
FROM event_push_actions AS ea
LEFT JOIN event_push_summary AS old USING (user_id, room_id)
WHERE ? < ea.stream_ordering AND ea.stream_ordering <= ?
AND (
old.last_receipt_stream_ordering IS NULL
OR old.last_receipt_stream_ordering < ea.stream_ordering
)
AND %s = 1
GROUP BY user_id, room_id
) AS upd


+ 7
- 0
tests/storage/test_event_push_actions.py View File

@@ -196,6 +196,13 @@ class EventPushActionsStoreTestCase(HomeserverTestCase):
_mark_read(10, 10)
_assert_counts(0, 0)

_inject_actions(11, HIGHLIGHT)
_assert_counts(1, 1)
_mark_read(11, 11)
_assert_counts(0, 0)
_rotate(11)
_assert_counts(0, 0)

def test_find_first_stream_ordering_after_ts(self) -> None:
def add_event(so: int, ts: int) -> None:
self.get_success(


Loading…
Cancel
Save