summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-05-24 10:22:24 +0100
committerErik Johnston <erik@matrix.org>2016-05-24 10:22:24 +0100
commit79bea8ab9a4c4cb4a0907784603698731424c00a (patch)
tree52e254dabaade2f53e251b4cbfd3e7f871e0ecf1 /synapse
parentAdd comments (diff)
downloadsynapse-79bea8ab9a4c4cb4a0907784603698731424c00a.tar.xz
Inline function. Make load_filtered_recents private
Diffstat (limited to '')
-rw-r--r--synapse/handlers/sync.py24
1 files changed, 7 insertions, 17 deletions
diff --git a/synapse/handlers/sync.py b/synapse/handlers/sync.py
index 271dd4c147..3aa4432d68 100644
--- a/synapse/handlers/sync.py
+++ b/synapse/handlers/sync.py
@@ -203,17 +203,6 @@ class SyncHandler(object):
         rules = format_push_rules_for_user(user, rawrules, enabled_map)
         defer.returnValue(rules)
 
-    def account_data_for_user(self, account_data):
-        account_data_events = []
-
-        for account_data_type, content in account_data.items():
-            account_data_events.append({
-                "type": account_data_type,
-                "content": content,
-            })
-
-        return account_data_events
-
     @defer.inlineCallbacks
     def ephemeral_by_room(self, sync_config, now_token, since_token=None):
         """Get the ephemeral events for each room the user is in
@@ -277,8 +266,8 @@ class SyncHandler(object):
         defer.returnValue((now_token, ephemeral_by_room))
 
     @defer.inlineCallbacks
-    def load_filtered_recents(self, room_id, sync_config, now_token,
-                              since_token=None, recents=None, newly_joined_room=False):
+    def _load_filtered_recents(self, room_id, sync_config, now_token,
+                               since_token=None, recents=None, newly_joined_room=False):
         """
         Returns:
             a Deferred TimelineBatch
@@ -586,9 +575,10 @@ class SyncHandler(object):
                 sync_config.user
             )
 
-        account_data_for_user = sync_config.filter_collection.filter_account_data(
-            self.account_data_for_user(account_data)
-        )
+        account_data_for_user = sync_config.filter_collection.filter_account_data([
+            {"type": account_data_type, "content": content}
+            for account_data_type, content in account_data.items()
+        ])
 
         sync_result_builer.account_data = account_data_for_user
 
@@ -956,7 +946,7 @@ class SyncHandler(object):
         since_token = room_builder.since_token
         upto_token = room_builder.upto_token
 
-        batch = yield self.load_filtered_recents(
+        batch = yield self._load_filtered_recents(
             room_id, sync_config,
             now_token=upto_token,
             since_token=since_token,