summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2024-07-11 10:13:32 +0100
committerErik Johnston <erik@matrix.org>2024-07-11 10:13:32 +0100
commit880786de797ba3eff76b1ca0d43c027c0107f3bb (patch)
treed54ede96ee3ce7c9640227d79515f94a10ff4eef
parentFIXUP (diff)
downloadsynapse-880786de797ba3eff76b1ca0d43c027c0107f3bb.tar.xz
Handle $ME correctly
-rw-r--r--synapse/handlers/sliding_sync.py10
1 files changed, 9 insertions, 1 deletions
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))