summary refs log tree commit diff
path: root/synapse/handlers/message.py
diff options
context:
space:
mode:
Diffstat (limited to 'synapse/handlers/message.py')
-rw-r--r--synapse/handlers/message.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/synapse/handlers/message.py b/synapse/handlers/message.py
index 11c736f727..95a8f05c05 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,7 +145,8 @@ class MessageHandler(BaseHandler):
             )
         )
 
-        events_and_states = zip(events, states)
+        for ev, state in event_id_to_state.items():
+            logger.info("event_id: %r, state: %r", ev, state)
 
         def allowed(event_and_state):
             event, state = event_and_state
@@ -179,10 +180,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