Fixed implementation errors

* Added HS as property in SyncRestServlet
* Fixed set_timeline_upper_limit function implementat¡ion
This commit is contained in:
Pablo Saavedra 2017-05-15 14:51:43 +02:00
parent 9da4316ca5
commit 627e6ea2b0
2 changed files with 7 additions and 3 deletions

View file

@ -52,6 +52,9 @@ def client_v2_patterns(path_regex, releases=(0,),
def set_timeline_upper_limit(filter_json, filter_timeline_limit): def set_timeline_upper_limit(filter_json, filter_timeline_limit):
if filter_timeline_limit < 0: if filter_timeline_limit < 0:
return # no upper limits return # no upper limits
if 'room' in filter_json and 'limit' in filter_json['room']: if 'room' in filter_json \
filter_json['room']["limit"] = min(filter_json['room']["limit"], 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) filter_timeline_limit)

View file

@ -79,6 +79,7 @@ class SyncRestServlet(RestServlet):
def __init__(self, hs): def __init__(self, hs):
super(SyncRestServlet, self).__init__() super(SyncRestServlet, self).__init__()
self.hs = hs
self.auth = hs.get_auth() self.auth = hs.get_auth()
self.sync_handler = hs.get_sync_handler() self.sync_handler = hs.get_sync_handler()
self.clock = hs.get_clock() self.clock = hs.get_clock()