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

Commit

Permalink
Merge pull request #3267 from matrix-org/erikj/iter_filter
Browse files Browse the repository at this point in the history
Use iter* methods for _filter_events_for_server
  • Loading branch information
erikjohnston authored May 24, 2018
2 parents 8c98281 + 5aaa318 commit 68399fc
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions synapse/handlers/federation.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,18 +479,18 @@ def check_match(id):
# to get all state ids that we're interested in.
event_map = yield self.store.get_events([
e_id
for key_to_eid in event_to_state_ids.values()
for key, e_id in key_to_eid.items()
for key_to_eid in event_to_state_ids.itervalues()
for key, e_id in key_to_eid.iteritems()
if key[0] != EventTypes.Member or check_match(key[1])
])

event_to_state = {
e_id: {
key: event_map[inner_e_id]
for key, inner_e_id in key_to_eid.items()
for key, inner_e_id in key_to_eid.iteritems()
if inner_e_id in event_map
}
for e_id, key_to_eid in event_to_state_ids.items()
for e_id, key_to_eid in event_to_state_ids.iteritems()
}

def redact_disallowed(event, state):
Expand All @@ -505,7 +505,7 @@ def redact_disallowed(event, state):
# membership states for the requesting server to determine
# if the server is either in the room or has been invited
# into the room.
for ev in state.values():
for ev in state.itervalues():
if ev.type != EventTypes.Member:
continue
try:
Expand Down

0 comments on commit 68399fc

Please sign in to comment.