Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

only try to LL members after a non-gappy incr sync if the timeline has events #3936

Merged
merged 3 commits into from
Sep 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/3936.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix out-of-bounds error when LLing yourself
13 changes: 8 additions & 5 deletions synapse/handlers/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -713,10 +713,6 @@ def compute_state_delta(self, room_id, batch, sync_config, since_token, now_toke
)
]

# always make sure we LL ourselves so we know we're in the room
# (if we are), to fix https://github.com/vector-im/riot-web/issues/7209
types.append((EventTypes.Member, sync_config.user.to_string()))

# only apply the filtering to room members
filtered_types = [EventTypes.Member]

Expand All @@ -726,6 +722,13 @@ def compute_state_delta(self, room_id, batch, sync_config, since_token, now_toke
}

if full_state:
if lazy_load_members:
# always make sure we LL ourselves so we know we're in the room
# (if we are) to fix https://github.com/vector-im/riot-web/issues/7209
# We only need apply this on full state syncs given we disabled
# LL for incr syncs in #3840.
types.append((EventTypes.Member, sync_config.user.to_string()))

if batch:
current_state_ids = yield self.store.get_state_ids_for_event(
batch.events[-1].event_id, types=types,
Expand Down Expand Up @@ -794,7 +797,7 @@ def compute_state_delta(self, room_id, batch, sync_config, since_token, now_toke
else:
state_ids = {}
if lazy_load_members:
if types:
if types and batch.events:
richvdh marked this conversation as resolved.
Show resolved Hide resolved
ara4n marked this conversation as resolved.
Show resolved Hide resolved
# We're returning an incremental sync, with no
# "gap" since the previous sync, so normally there would be
# no state to return.
Expand Down