summary refs log tree commit diff
path: root/synapse/rest/client
diff options
context:
space:
mode:
authorPablo Saavedra <psaavedra@igalia.com>2017-05-15 14:51:43 +0200
committerPablo Saavedra <psaavedra@igalia.com>2017-05-15 14:51:43 +0200
commit627e6ea2b0b941c67f8752736993f82a5f123e76 (patch)
treece83ffe6c85582f936ec7137ced211ada9101e86 /synapse/rest/client
parentConfigurable maximum number of events requested by /sync and /messages (#2220) (diff)
downloadsynapse-627e6ea2b0b941c67f8752736993f82a5f123e76.tar.xz
Fixed implementation errors
* Added HS as property in SyncRestServlet
* Fixed set_timeline_upper_limit function implementat¡ion
Diffstat (limited to 'synapse/rest/client')
-rw-r--r--synapse/rest/client/v2_alpha/_base.py9
-rw-r--r--synapse/rest/client/v2_alpha/sync.py1
2 files changed, 7 insertions, 3 deletions
diff --git a/synapse/rest/client/v2_alpha/_base.py b/synapse/rest/client/v2_alpha/_base.py
index 279e2a7751..fd8f915655 100644
--- a/synapse/rest/client/v2_alpha/_base.py
+++ b/synapse/rest/client/v2_alpha/_base.py
@@ -52,6 +52,9 @@ def client_v2_patterns(path_regex, releases=(0,),
 def set_timeline_upper_limit(filter_json, filter_timeline_limit):
     if filter_timeline_limit < 0:
         return  # no upper limits
-    if 'room' in filter_json and 'limit' in filter_json['room']:
-        filter_json['room']["limit"] = min(filter_json['room']["limit"],
-                                           filter_timeline_limit)
+    if 'room' in filter_json \
+            and 'timeline' in filter_json['room'] \
+            and 'limit' in filter_json['room']['timeline']:
+        filter_json['room']['timeline']["limit"] = min(
+            filter_json['room']['timeline']['limit'],
+            filter_timeline_limit)
diff --git a/synapse/rest/client/v2_alpha/sync.py b/synapse/rest/client/v2_alpha/sync.py
index f5e7349c5c..771e127ab9 100644
--- a/synapse/rest/client/v2_alpha/sync.py
+++ b/synapse/rest/client/v2_alpha/sync.py
@@ -79,6 +79,7 @@ class SyncRestServlet(RestServlet):
 
     def __init__(self, hs):
         super(SyncRestServlet, self).__init__()
+        self.hs = hs
         self.auth = hs.get_auth()
         self.sync_handler = hs.get_sync_handler()
         self.clock = hs.get_clock()