From d4daff9b59bc2c837d60b132aaaea85d1c0f00b4 Mon Sep 17 00:00:00 2001 From: Brendan Abolivier Date: Tue, 8 Sep 2020 15:26:06 +0100 Subject: [PATCH 1/2] Fix /notifications and pushers misbehaving because of unread counts (#8280) --- changelog.d/8280.bugfix | 1 + synapse/storage/databases/main/event_push_actions.py | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 changelog.d/8280.bugfix diff --git a/changelog.d/8280.bugfix b/changelog.d/8280.bugfix new file mode 100644 index 0000000000..e306282438 --- /dev/null +++ b/changelog.d/8280.bugfix @@ -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. diff --git a/synapse/storage/databases/main/event_push_actions.py b/synapse/storage/databases/main/event_push_actions.py index 50fac9e72e..5233ed83e2 100644 --- a/synapse/storage/databases/main/event_push_actions.py +++ b/synapse/storage/databases/main/event_push_actions.py @@ -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,) ) From 536f4a2482dbce213f030f4c07e92dab579d7f22 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Wed, 9 Sep 2020 17:08:33 +0100 Subject: [PATCH 2/2] 1.20.0rc2 --- CHANGES.md | 9 +++++++++ changelog.d/8280.bugfix | 1 - synapse/__init__.py | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) delete mode 100644 changelog.d/8280.bugfix diff --git a/CHANGES.md b/CHANGES.md index 81f9a1aa26..dbef6ab6c7 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,12 @@ +Synapse 1.20.0rc2 (2020-09-09) +============================== + +Bugfixes +-------- + +- Fix a bug introduced in v1.20.0rc1 causing some features related to notifications to misbehave following the implementation of unread counts. ([\#8280](https://github.com/matrix-org/synapse/issues/8280)) + + Synapse 1.20.0rc1 (2020-09-08) ============================== diff --git a/changelog.d/8280.bugfix b/changelog.d/8280.bugfix deleted file mode 100644 index e306282438..0000000000 --- a/changelog.d/8280.bugfix +++ /dev/null @@ -1 +0,0 @@ -Fix a bug introduced in v1.20.0rc1 causing some features related to notifications to misbehave following the implementation of unread counts. diff --git a/synapse/__init__.py b/synapse/__init__.py index f4aca64be8..7e8731f86a 100644 --- a/synapse/__init__.py +++ b/synapse/__init__.py @@ -48,7 +48,7 @@ try: except ImportError: pass -__version__ = "1.20.0rc1" +__version__ = "1.20.0rc2" if bool(os.environ.get("SYNAPSE_TEST_PATCH_LOG_CONTEXTS", False)): # We import here so that we don't have to install a bunch of deps when