Fixed implementation errors

* Added HS as property in SyncRestServlet
* Fixed set_timeline_upper_limit function implementat¡ion
pull/2221/head
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):
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)

View File

@ -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()