Sliding Sync: Add comment to explain extra case where you can be invited -> banned -> unbanned (#17654)
Add comment to explain extra case where you can be invited -> banned -> unbanned and we want to be able to find the invite event. Follow-up to https://github.com/element-hq/synapse/pull/17636#discussion_r1738993330
This commit is contained in:
parent
e1ed959a68
commit
515c1cc0a1
|
@ -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.
|
|
@ -1966,7 +1966,7 @@ class EventsBackgroundUpdatesStore(StreamWorkerStore, StateDeltasStore, SQLBaseS
|
||||||
)
|
)
|
||||||
return 0
|
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
|
txn: LoggingTransaction, room_id: str, user_id: str, event_id: str
|
||||||
) -> Tuple[str, str]:
|
) -> Tuple[str, str]:
|
||||||
# Find the previous invite/knock event before the leave event
|
# Find the previous invite/knock event before the leave event
|
||||||
|
@ -2007,6 +2007,10 @@ class EventsBackgroundUpdatesStore(StreamWorkerStore, StateDeltasStore, SQLBaseS
|
||||||
(
|
(
|
||||||
room_id,
|
room_id,
|
||||||
user_id,
|
user_id,
|
||||||
|
# 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.
|
||||||
Membership.INVITE,
|
Membership.INVITE,
|
||||||
Membership.KNOCK,
|
Membership.KNOCK,
|
||||||
event_id,
|
event_id,
|
||||||
|
@ -2155,8 +2159,8 @@ class EventsBackgroundUpdatesStore(StreamWorkerStore, StateDeltasStore, SQLBaseS
|
||||||
invite_or_knock_event_id,
|
invite_or_knock_event_id,
|
||||||
invite_or_knock_membership,
|
invite_or_knock_membership,
|
||||||
) = await self.db_pool.runInteraction(
|
) = await self.db_pool.runInteraction(
|
||||||
"sliding_sync_membership_snapshots_bg_update._find_previous_membership",
|
"sliding_sync_membership_snapshots_bg_update._find_previous_invite_or_knock_membership_txn",
|
||||||
_find_previous_membership_txn,
|
_find_previous_invite_or_knock_membership_txn,
|
||||||
room_id,
|
room_id,
|
||||||
user_id,
|
user_id,
|
||||||
membership_event_id,
|
membership_event_id,
|
||||||
|
|
Loading…
Reference in New Issue