diff options
author | Erik Johnston <erik@matrix.org> | 2015-08-11 17:19:21 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2015-08-11 17:19:21 +0100 |
commit | 40affadaaa416aa341b84685df3f336d68467aff (patch) | |
tree | 617dd00c278830309034a84ec188ea8dc8077775 /synapse/handlers/message.py | |
parent | Lower cache size (diff) | |
download | synapse-40affadaaa416aa341b84685df3f336d68467aff.tar.xz |
Fix ACL filtering github/erikj/acl_perf erikj/acl_perf
Diffstat (limited to 'synapse/handlers/message.py')
-rw-r--r-- | synapse/handlers/message.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/synapse/handlers/message.py b/synapse/handlers/message.py index 765b14d994..8d8020cd44 100644 --- a/synapse/handlers/message.py +++ b/synapse/handlers/message.py @@ -137,7 +137,7 @@ class MessageHandler(BaseHandler): @defer.inlineCallbacks def _filter_events_for_client(self, user_id, room_id, events): - states = yield self.store.get_state_for_events( + event_id_to_state = yield self.store.get_state_for_events( room_id, frozenset(e.event_id for e in events), types=( (EventTypes.RoomHistoryVisibility, ""), @@ -145,8 +145,6 @@ class MessageHandler(BaseHandler): ) ) - events_and_states = zip(events, states) - def allowed(event_and_state): event, state = event_and_state @@ -179,10 +177,17 @@ class MessageHandler(BaseHandler): return True - events_and_states = filter(allowed, events_and_states) + event_and_state = filter( + allowed, + [ + (e, event_id_to_state[e.event_id]) + for e in events + ] + ) + defer.returnValue([ ev - for ev, _ in events_and_states + for ev, _ in event_and_state ]) @defer.inlineCallbacks |