From 880786de797ba3eff76b1ca0d43c027c0107f3bb Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Thu, 11 Jul 2024 10:13:32 +0100 Subject: Handle $ME correctly --- synapse/handlers/sliding_sync.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/synapse/handlers/sliding_sync.py b/synapse/handlers/sliding_sync.py index 7926b34c4d..27a7fd8eca 100644 --- a/synapse/handlers/sliding_sync.py +++ b/synapse/handlers/sliding_sync.py @@ -286,6 +286,8 @@ class StateValues: # `state_key`. LAZY: Final = "$LAZY" + ME: Final = "$ME" + @attr.s(slots=True, frozen=True, auto_attribs=True) class _RoomMembershipForUser: @@ -466,7 +468,6 @@ class SlidingSyncHandler: # Also see `StateFilter.must_await_full_state(...)` for comparison lazy_loading = ( membership_state_keys is not None - and len(membership_state_keys) == 1 and StateValues.LAZY in membership_state_keys ) @@ -1337,6 +1338,13 @@ class SlidingSyncHandler: # FIXME: We probably also care about invite, ban, kick, targets, etc # but the spec only mentions "senders". + elif ( + state_type == EventTypes.Member + and state_key == StateValues.ME + ): + required_state_types.append( + (EventTypes.Member, user.to_string()) + ) else: required_state_types.append((state_type, state_key)) -- cgit 1.4.1