diff options
author | Erik Johnston <erikj@element.io> | 2024-07-22 17:48:09 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-22 17:48:09 +0100 |
commit | d221512498f7e3267916a289dd2ef4f3e00728e8 (patch) | |
tree | 972a653dae8e0c11103da60377968190e07e256e /synapse | |
parent | Speed up room keys query by using read/write lock (#17461) (diff) | |
download | synapse-d221512498f7e3267916a289dd2ef4f3e00728e8.tar.xz |
SS: Implement `$ME` support (#17469)
`$ME` can be used as a substitute for the requester's user ID.
Diffstat (limited to 'synapse')
-rw-r--r-- | synapse/handlers/sliding_sync.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/synapse/handlers/sliding_sync.py b/synapse/handlers/sliding_sync.py index 423f0329d6..c362afa6e2 100644 --- a/synapse/handlers/sliding_sync.py +++ b/synapse/handlers/sliding_sync.py @@ -329,6 +329,9 @@ class StateValues: # `sender` in the timeline). We only give special meaning to this value when it's a # `state_key`. LAZY: Final = "$LAZY" + # Subsitute with the requester's user ID. Typically used by clients to get + # the user's membership. + ME: Final = "$ME" class SlidingSyncHandler: @@ -504,7 +507,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 ) @@ -1662,6 +1664,8 @@ class SlidingSyncHandler: # FIXME: We probably also care about invite, ban, kick, targets, etc # but the spec only mentions "senders". + elif state_key == StateValues.ME: + required_state_types.append((state_type, user.to_string())) else: required_state_types.append((state_type, state_key)) |