diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2016-11-15 16:56:29 +0100 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2016-11-15 16:56:29 +0100 |
commit | fdc17bea58f210f62ac0d9e836b68e84c6dbd15c (patch) | |
tree | 491613c94695ba867e81d50124e7e3eb73a0eff5 /app/controllers/api/v1/timelines_controller.rb | |
parent | a91c3ef6cef0fe5a1645c043e7d4a5ef96e82c4f (diff) |
Fix rubocop issues, introduce usage of frozen literal to improve performance
Diffstat (limited to 'app/controllers/api/v1/timelines_controller.rb')
-rw-r--r-- | app/controllers/api/v1/timelines_controller.rb | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/app/controllers/api/v1/timelines_controller.rb b/app/controllers/api/v1/timelines_controller.rb index 6d7858c76..19b76f11d 100644 --- a/app/controllers/api/v1/timelines_controller.rb +++ b/app/controllers/api/v1/timelines_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Api::V1::TimelinesController < ApiController before_action -> { doorkeeper_authorize! :read } before_action :require_user!, only: [:home, :mentions] @@ -10,7 +12,7 @@ class Api::V1::TimelinesController < ApiController set_maps(@statuses) next_path = api_v1_home_timeline_url(max_id: @statuses.last.id) if @statuses.size == DEFAULT_STATUSES_LIMIT - prev_path = api_v1_home_timeline_url(since_id: @statuses.first.id) if @statuses.size > 0 + prev_path = api_v1_home_timeline_url(since_id: @statuses.first.id) unless @statuses.empty? set_pagination_headers(next_path, prev_path) @@ -23,7 +25,7 @@ class Api::V1::TimelinesController < ApiController set_maps(@statuses) next_path = api_v1_mentions_timeline_url(max_id: @statuses.last.id) if @statuses.size == DEFAULT_STATUSES_LIMIT - prev_path = api_v1_mentions_timeline_url(since_id: @statuses.first.id) if @statuses.size > 0 + prev_path = api_v1_mentions_timeline_url(since_id: @statuses.first.id) unless @statuses.empty? set_pagination_headers(next_path, prev_path) @@ -36,7 +38,7 @@ class Api::V1::TimelinesController < ApiController set_maps(@statuses) next_path = api_v1_public_timeline_url(max_id: @statuses.last.id) if @statuses.size == DEFAULT_STATUSES_LIMIT - prev_path = api_v1_public_timeline_url(since_id: @statuses.first.id) if @statuses.size > 0 + prev_path = api_v1_public_timeline_url(since_id: @statuses.first.id) unless @statuses.empty? set_pagination_headers(next_path, prev_path) @@ -50,7 +52,7 @@ class Api::V1::TimelinesController < ApiController set_maps(@statuses) next_path = api_v1_hashtag_timeline_url(params[:id], max_id: @statuses.last.id) if @statuses.size == DEFAULT_STATUSES_LIMIT - prev_path = api_v1_hashtag_timeline_url(params[:id], since_id: @statuses.first.id) if @statuses.size > 0 + prev_path = api_v1_hashtag_timeline_url(params[:id], since_id: @statuses.first.id) unless @statuses.empty? set_pagination_headers(next_path, prev_path) |