Only work out newly_joined_users for incremental sync

This commit is contained in:
Erik Johnston 2016-05-24 11:21:34 +01:00
parent b08ad0389e
commit 1c5ed2a19b
1 changed files with 9 additions and 6 deletions

View File

@ -699,12 +699,15 @@ class SyncHandler(object):
# Now we want to get any newly joined users
newly_joined_users = set()
for joined_sync in sync_result_builder.joined:
it = itertools.chain(joined_sync.timeline.events, joined_sync.state.values())
for event in it:
if event.type == EventTypes.Member:
if event.membership == Membership.JOIN:
newly_joined_users.add(event.state_key)
if sync_result_builder.since_token:
for joined_sync in sync_result_builder.joined:
it = itertools.chain(
joined_sync.timeline.events, joined_sync.state.values()
)
for event in it:
if event.type == EventTypes.Member:
if event.membership == Membership.JOIN:
newly_joined_users.add(event.state_key)
defer.returnValue((newly_joined_rooms, newly_joined_users))