summary refs log tree commit diff
path: root/synapse/handlers
diff options
context:
space:
mode:
authorMatthew Hodgson <matthew@matrix.org>2018-07-24 12:39:40 +0100
committerMatthew Hodgson <matthew@matrix.org>2018-07-24 12:39:40 +0100
commitcd241d6bda01a761fbe1ca29727dacd918fb8975 (patch)
treeb430c373ea65462a02237e3ca81ed9f56375e389 /synapse/handlers
parenthandle case where types is [] on postgres correctly (diff)
downloadsynapse-cd241d6bda01a761fbe1ca29727dacd918fb8975.tar.xz
incorporate more review
Diffstat (limited to 'synapse/handlers')
-rw-r--r--synapse/handlers/sync.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/synapse/handlers/sync.py b/synapse/handlers/sync.py

index 5689ad2f58..e5a2329d73 100644 --- a/synapse/handlers/sync.py +++ b/synapse/handlers/sync.py
@@ -1526,6 +1526,9 @@ def _calculate_state( previous (dict): state at the end of the previous sync (or empty dict if this is an initial sync) current (dict): state at the end of the timeline + lazy_load_members (bool): whether to return members from timeline_start + or not. assumes that timeline_start has already been filtered to + include only the members the client needs to know about. Returns: dict @@ -1545,9 +1548,12 @@ def _calculate_state( p_ids = set(e for e in previous.values()) tc_ids = set(e for e in timeline_contains.values()) - # track the membership events in the state as of the start of the timeline - # so we can add them back in to the state if we're lazyloading. We don't - # add them into state if they're already contained in the timeline. + # If we are lazyloading room members, we explicitly add the membership events + # for the senders in the timeline into the state block returned by /sync, + # as we may not have sent them to the client before. We find these membership + # events by filtering them out of timeline_start, which has already been filtered + # to only include membership events for the senders in the timeline. + if lazy_load_members: ll_ids = set( e for t, e in timeline_start.iteritems()