simplify timeline_start_members

This commit is contained in:
Matthew Hodgson 2018-03-16 01:17:34 +00:00
parent bf49d2dca8
commit 5b3b3aada8

View File

@ -496,12 +496,6 @@ class SyncHandler(object):
batch.events[0].event_id, types=types batch.events[0].event_id, types=types
) )
if filter_members:
member_state_ids = {
t: state_ids[t]
for t in state_ids if state_ids[t][0] == EventTypes.Member
}
else: else:
current_state_ids = yield self.get_state_at( current_state_ids = yield self.get_state_at(
room_id, stream_position=now_token, types=types room_id, stream_position=now_token, types=types
@ -510,10 +504,12 @@ class SyncHandler(object):
state_ids = current_state_ids state_ids = current_state_ids
if filter_members: if filter_members:
logger.info("Finding members from %r", state_ids)
member_state_ids = { member_state_ids = {
t: state_ids[t] e: state_ids[e]
for t in state_ids if state_ids[t][0] == EventTypes.Member for e in state_ids if state_ids[e][0] == EventTypes.Member
} }
logger.info("Found members %r", member_state_ids)
timeline_state = { timeline_state = {
(event.type, event.state_key): event.event_id (event.type, event.state_key): event.event_id
@ -541,11 +537,14 @@ class SyncHandler(object):
) )
if filter_members: if filter_members:
logger.info("Finding members from %r", state_at_timeline_start)
member_state_ids = { member_state_ids = {
t: state_at_timeline_start[t] e: state_at_timeline_start[e]
for t in state_at_timeline_start for e in state_at_timeline_start
if state_at_timeline_start[t][0] == EventTypes.Member if state_at_timeline_start[e][0] == EventTypes.Member
} }
logger.info("Found members %r", member_state_ids)
timeline_state = { timeline_state = {
(event.type, event.state_key): event.event_id (event.type, event.state_key): event.event_id