From 5a0cb279574e59bf1083f4ea34f8ad5e96f3f1a6 Mon Sep 17 00:00:00 2001 From: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com> Date: Tue, 5 Mar 2024 15:53:57 +0000 Subject: [PATCH] Revert "Ignore notification counts from rooms you've left (#16954)" This reverts commit 274f289a52a0097784d7179c1d912dbc3cfda3ee. --- changelog.d/16954.bugfix | 1 - .../databases/main/event_push_actions.py | 18 +++--------------- 2 files changed, 3 insertions(+), 16 deletions(-) delete mode 100644 changelog.d/16954.bugfix diff --git a/changelog.d/16954.bugfix b/changelog.d/16954.bugfix deleted file mode 100644 index 7e5ad69094c..00000000000 --- a/changelog.d/16954.bugfix +++ /dev/null @@ -1 +0,0 @@ -Fix a bug introduced in v1.100.0 where notifications from rooms you've left would continue to be counted. \ No newline at end of file diff --git a/synapse/storage/databases/main/event_push_actions.py b/synapse/storage/databases/main/event_push_actions.py index 56c549ae660..d7aa8a0ee0b 100644 --- a/synapse/storage/databases/main/event_push_actions.py +++ b/synapse/storage/databases/main/event_push_actions.py @@ -404,11 +404,7 @@ def _get_unread_counts_by_room_for_user_txn( SELECT e.room_id, notif_count, e.stream_ordering, e.thread_id, last_receipt_stream_ordering, ev.stream_ordering AS receipt_stream_ordering FROM event_push_summary AS e - INNER JOIN local_current_membership AS lcm ON ( - e.user_id = lcm.user_id - AND e.room_id = lcm.room_id - AND lcm.membership = 'join' - ) + INNER JOIN local_current_membership USING (user_id, room_id) LEFT JOIN receipts_linearized AS r ON ( e.user_id = r.user_id AND e.room_id = r.room_id @@ -476,11 +472,7 @@ def _get_unread_counts_by_room_for_user_txn( SELECT e.room_id, e.stream_ordering, e.thread_id, ev.stream_ordering AS receipt_stream_ordering FROM event_push_actions AS e - INNER JOIN local_current_membership AS lcm ON ( - e.user_id = lcm.user_id - AND e.room_id = lcm.room_id - AND lcm.membership = 'join' - ) + INNER JOIN local_current_membership USING (user_id, room_id) LEFT JOIN receipts_linearized AS r ON ( e.user_id = r.user_id AND e.room_id = r.room_id @@ -522,11 +514,7 @@ def _get_unread_counts_by_room_for_user_txn( SELECT e.room_id, e.stream_ordering, e.thread_id, ev.stream_ordering AS receipt_stream_ordering FROM event_push_actions AS e - INNER JOIN local_current_membership AS lcm ON ( - e.user_id = lcm.user_id - AND e.room_id = lcm.room_id - AND lcm.membership = 'join' - ) + INNER JOIN local_current_membership USING (user_id, room_id) LEFT JOIN receipts_linearized AS r ON ( e.user_id = r.user_id AND e.room_id = r.room_id