diff options
author | Erik Johnston <erik@matrix.org> | 2017-05-08 13:07:41 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2017-05-08 13:07:41 +0100 |
commit | 78f306a6f70552672f8c70171b2d9d79f20f8f8d (patch) | |
tree | ed9bdff4e0837e2220b66cec398736a94478cea6 /synapse/visibility.py | |
parent | Merge pull request #2192 from matrix-org/kegan/simple-http-client-timeouts (diff) | |
download | synapse-78f306a6f70552672f8c70171b2d9d79f20f8f8d.tar.xz |
Revert "Speed up filtering of a single event in push"
This reverts commit 421fdf74609439edaaffce117436e6a6df147841.
Diffstat (limited to '')
-rw-r--r-- | synapse/visibility.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/synapse/visibility.py b/synapse/visibility.py index 5590b866ed..c4dd9ae2c7 100644 --- a/synapse/visibility.py +++ b/synapse/visibility.py @@ -189,6 +189,25 @@ def filter_events_for_clients(store, user_tuples, events, event_id_to_state): @defer.inlineCallbacks +def filter_events_for_clients_context(store, user_tuples, events, event_id_to_context): + user_ids = set(u[0] for u in user_tuples) + event_id_to_state = {} + for event_id, context in event_id_to_context.items(): + state = yield store.get_events([ + e_id + for key, e_id in context.current_state_ids.iteritems() + if key == (EventTypes.RoomHistoryVisibility, "") + or (key[0] == EventTypes.Member and key[1] in user_ids) + ]) + event_id_to_state[event_id] = state + + res = yield filter_events_for_clients( + store, user_tuples, events, event_id_to_state + ) + defer.returnValue(res) + + +@defer.inlineCallbacks def filter_events_for_client(store, user_id, events, is_peeking=False): """ Check which events a user is allowed to see |