summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorAndrew Morgan <1342360+anoadragon453@users.noreply.github.com>2024-02-23 14:12:10 +0000
committerGitHub <noreply@github.com>2024-02-23 14:12:10 +0000
commit274f289a52a0097784d7179c1d912dbc3cfda3ee (patch)
tree451fe90b506623f1a0e993248c6ed6227edc93c1 /synapse
parentAdd docs on upgrading from a very old version (#16951) (diff)
downloadsynapse-274f289a52a0097784d7179c1d912dbc3cfda3ee.tar.xz
Ignore notification counts from rooms you've left (#16954)
Co-authored-by: reivilibre <oliverw@matrix.org>
Diffstat (limited to 'synapse')
-rw-r--r--synapse/storage/databases/main/event_push_actions.py18
1 files changed, 15 insertions, 3 deletions
diff --git a/synapse/storage/databases/main/event_push_actions.py b/synapse/storage/databases/main/event_push_actions.py
index d7aa8a0ee0..56c549ae66 100644
--- a/synapse/storage/databases/main/event_push_actions.py
+++ b/synapse/storage/databases/main/event_push_actions.py
@@ -404,7 +404,11 @@ class EventPushActionsWorkerStore(ReceiptsWorkerStore, StreamWorkerStore, SQLBas
                 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 USING (user_id, room_id)
+                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'
+                )
                 LEFT JOIN receipts_linearized AS r ON (
                     e.user_id = r.user_id
                     AND e.room_id = r.room_id
@@ -472,7 +476,11 @@ class EventPushActionsWorkerStore(ReceiptsWorkerStore, StreamWorkerStore, SQLBas
                 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 USING (user_id, room_id)
+                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'
+                )
                 LEFT JOIN receipts_linearized AS r ON (
                     e.user_id = r.user_id
                     AND e.room_id = r.room_id
@@ -514,7 +522,11 @@ class EventPushActionsWorkerStore(ReceiptsWorkerStore, StreamWorkerStore, SQLBas
                     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 USING (user_id, room_id)
+                    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'
+                    )
                     LEFT JOIN receipts_linearized AS r ON (
                         e.user_id = r.user_id
                         AND e.room_id = r.room_id