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

Commit d4daff9

Browse files
authored
Fix /notifications and pushers misbehaving because of unread counts (#8280)
1 parent 6d01eb0 commit d4daff9

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

changelog.d/8280.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix a bug introduced in v1.20.0rc1 causing some features related to notifications to misbehave following the implementation of unread counts.

synapse/storage/databases/main/event_push_actions.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ async def get_push_action_users_in_range(
196196
def f(txn):
197197
sql = (
198198
"SELECT DISTINCT(user_id) FROM event_push_actions WHERE"
199-
" stream_ordering >= ? AND stream_ordering <= ?"
199+
" stream_ordering >= ? AND stream_ordering <= ? AND notif = 1"
200200
)
201201
txn.execute(sql, (min_stream_ordering, max_stream_ordering))
202202
return [r[0] for r in txn]
@@ -644,7 +644,7 @@ def f(txn):
644644
"SELECT e.received_ts"
645645
" FROM event_push_actions AS ep"
646646
" JOIN events e ON ep.room_id = e.room_id AND ep.event_id = e.event_id"
647-
" WHERE ep.stream_ordering > ?"
647+
" WHERE ep.stream_ordering > ? AND notif = 1"
648648
" ORDER BY ep.stream_ordering ASC"
649649
" LIMIT 1"
650650
)
@@ -708,6 +708,7 @@ def f(txn):
708708
" FROM event_push_actions epa, events e"
709709
" WHERE epa.event_id = e.event_id"
710710
" AND epa.user_id = ? %s"
711+
" AND epa.notif = 1"
711712
" ORDER BY epa.stream_ordering DESC"
712713
" LIMIT ?" % (before_clause,)
713714
)

0 commit comments

Comments
 (0)