Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Fixed syntax nits
Browse files Browse the repository at this point in the history
  • Loading branch information
psaavedra committed May 15, 2017
1 parent 627e6ea commit 224137f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 2 additions & 3 deletions synapse/rest/client/v2_alpha/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,8 @@ 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 'timeline' in filter_json['room'] \
and 'limit' in filter_json['room']['timeline']:
timeline = filter_json.get('room', {}).get('timeline', {})
if 'limit' in timeline:
filter_json['room']['timeline']["limit"] = min(
filter_json['room']['timeline']['limit'],
filter_timeline_limit)
6 changes: 4 additions & 2 deletions synapse/rest/client/v2_alpha/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,10 @@ def on_POST(self, request, user_id):
raise AuthError(403, "Can only create filters for local users")

content = parse_json_object_from_request(request)
set_timeline_upper_limit(content,
self.hs.config.filter_timeline_limit)
set_timeline_upper_limit(
content,
self.hs.config.filter_timeline_limit
)

filter_id = yield self.filtering.add_user_filter(
user_localpart=target_user.localpart,
Expand Down

0 comments on commit 224137f

Please sign in to comment.