Fix /notifications and pushers misbehaving because of unread counts (#8280)

This commit is contained in:
Brendan Abolivier 2020-09-08 15:26:06 +01:00 committed by GitHub
parent 6d01eb0c74
commit d4daff9b59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

1
changelog.d/8280.bugfix Normal file
View File

@ -0,0 +1 @@
Fix a bug introduced in v1.20.0rc1 causing some features related to notifications to misbehave following the implementation of unread counts.

View File

@ -196,7 +196,7 @@ class EventPushActionsWorkerStore(SQLBaseStore):
def f(txn):
sql = (
"SELECT DISTINCT(user_id) FROM event_push_actions WHERE"
" stream_ordering >= ? AND stream_ordering <= ?"
" stream_ordering >= ? AND stream_ordering <= ? AND notif = 1"
)
txn.execute(sql, (min_stream_ordering, max_stream_ordering))
return [r[0] for r in txn]
@ -644,7 +644,7 @@ class EventPushActionsWorkerStore(SQLBaseStore):
"SELECT e.received_ts"
" FROM event_push_actions AS ep"
" JOIN events e ON ep.room_id = e.room_id AND ep.event_id = e.event_id"
" WHERE ep.stream_ordering > ?"
" WHERE ep.stream_ordering > ? AND notif = 1"
" ORDER BY ep.stream_ordering ASC"
" LIMIT 1"
)
@ -708,6 +708,7 @@ class EventPushActionsStore(EventPushActionsWorkerStore):
" FROM event_push_actions epa, events e"
" WHERE epa.event_id = e.event_id"
" AND epa.user_id = ? %s"
" AND epa.notif = 1"
" ORDER BY epa.stream_ordering DESC"
" LIMIT ?" % (before_clause,)
)