From a6584aead71eb0160864bd8c4a8ae736e4459936 Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Tue, 3 Sep 2024 14:17:37 -0500 Subject: [PATCH 1/3] Add comment to explain extra case where you can be banned -> unbanned See https://github.com/element-hq/synapse/pull/17636#discussion_r1738993330 --- synapse/storage/databases/main/events_bg_updates.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/synapse/storage/databases/main/events_bg_updates.py b/synapse/storage/databases/main/events_bg_updates.py index 4209100a5ca..be1b1345471 100644 --- a/synapse/storage/databases/main/events_bg_updates.py +++ b/synapse/storage/databases/main/events_bg_updates.py @@ -1963,7 +1963,7 @@ def _find_memberships_to_update_txn( ) return 0 - def _find_previous_membership_txn( + def _find_previous_invite_or_knock_membership_txn( txn: LoggingTransaction, room_id: str, user_id: str, event_id: str ) -> Tuple[str, str]: # Find the previous invite/knock event before the leave event @@ -2004,6 +2004,10 @@ def _find_previous_membership_txn( ( room_id, user_id, + # We look explicitely for `invite` and `knock` events instead of + # just their previous membership as someone could have been `invite` + # -> `ban` -> unbanned (`leave`) and we want to find the `invite` + # event where the stripped state is. Membership.INVITE, Membership.KNOCK, event_id, @@ -2152,8 +2156,8 @@ def _find_previous_membership_txn( invite_or_knock_event_id, invite_or_knock_membership, ) = await self.db_pool.runInteraction( - "sliding_sync_membership_snapshots_bg_update._find_previous_membership", - _find_previous_membership_txn, + "sliding_sync_membership_snapshots_bg_update._find_previous_invite_or_knock_membership_txn", + _find_previous_invite_or_knock_membership_txn, room_id, user_id, membership_event_id, From 7cfb55a8ce0bba9258dcf2936a4f2757da21b715 Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Tue, 3 Sep 2024 14:20:14 -0500 Subject: [PATCH 2/3] Add changelog --- changelog.d/17654.misc | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/17654.misc diff --git a/changelog.d/17654.misc b/changelog.d/17654.misc new file mode 100644 index 00000000000..756918e2b21 --- /dev/null +++ b/changelog.d/17654.misc @@ -0,0 +1 @@ +Pre-populate room data used in experimental [MSC3575](https://github.com/matrix-org/matrix-spec-proposals/pull/3575) Sliding Sync `/sync` endpoint for quick filtering/sorting. From 39ac0967679991affe22b3cea1159c8026e4484e Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Mon, 9 Sep 2024 11:11:55 -0500 Subject: [PATCH 3/3] Fix typo --- synapse/storage/databases/main/events_bg_updates.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/synapse/storage/databases/main/events_bg_updates.py b/synapse/storage/databases/main/events_bg_updates.py index c20b4d4ab7f..12670e87d2a 100644 --- a/synapse/storage/databases/main/events_bg_updates.py +++ b/synapse/storage/databases/main/events_bg_updates.py @@ -2007,7 +2007,7 @@ def _find_previous_invite_or_knock_membership_txn( ( room_id, user_id, - # We look explicitely for `invite` and `knock` events instead of + # We look explicitly for `invite` and `knock` events instead of # just their previous membership as someone could have been `invite` # -> `ban` -> unbanned (`leave`) and we want to find the `invite` # event where the stripped state is.