about summary refs log tree commit diff
path: root/app/controllers/api/v1/accounts_controller.rb
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-11-15 16:56:29 +0100
committerEugen Rochko <eugen@zeonfederated.com>2016-11-15 16:56:29 +0100
commitfdc17bea58f210f62ac0d9e836b68e84c6dbd15c (patch)
tree491613c94695ba867e81d50124e7e3eb73a0eff5 /app/controllers/api/v1/accounts_controller.rb
parenta91c3ef6cef0fe5a1645c043e7d4a5ef96e82c4f (diff)
Fix rubocop issues, introduce usage of frozen literal to improve performance
Diffstat (limited to 'app/controllers/api/v1/accounts_controller.rb')
-rw-r--r--app/controllers/api/v1/accounts_controller.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/app/controllers/api/v1/accounts_controller.rb b/app/controllers/api/v1/accounts_controller.rb
index 88af41bf8..2dfab0831 100644
--- a/app/controllers/api/v1/accounts_controller.rb
+++ b/app/controllers/api/v1/accounts_controller.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 class Api::V1::AccountsController < ApiController
   before_action -> { doorkeeper_authorize! :read }, except: [:follow, :unfollow, :block, :unblock]
   before_action -> { doorkeeper_authorize! :follow }, only: [:follow, :unfollow, :block, :unblock]
@@ -20,7 +22,7 @@ class Api::V1::AccountsController < ApiController
     @accounts = results.map { |f| accounts[f.target_account_id] }
 
     next_path = following_api_v1_account_url(max_id: results.last.id)    if results.size == DEFAULT_ACCOUNTS_LIMIT
-    prev_path = following_api_v1_account_url(since_id: results.first.id) if results.size > 0
+    prev_path = following_api_v1_account_url(since_id: results.first.id) unless results.empty?
 
     set_pagination_headers(next_path, prev_path)
 
@@ -33,7 +35,7 @@ class Api::V1::AccountsController < ApiController
     @accounts = results.map { |f| accounts[f.account_id] }
 
     next_path = followers_api_v1_account_url(max_id: results.last.id)    if results.size == DEFAULT_ACCOUNTS_LIMIT
-    prev_path = followers_api_v1_account_url(since_id: results.first.id) if results.size > 0
+    prev_path = followers_api_v1_account_url(since_id: results.first.id) unless results.empty?
 
     set_pagination_headers(next_path, prev_path)
 
@@ -56,7 +58,7 @@ class Api::V1::AccountsController < ApiController
     set_maps(@statuses)
 
     next_path = statuses_api_v1_account_url(max_id: @statuses.last.id)    if @statuses.size == DEFAULT_STATUSES_LIMIT
-    prev_path = statuses_api_v1_account_url(since_id: @statuses.first.id) if @statuses.size > 0
+    prev_path = statuses_api_v1_account_url(since_id: @statuses.first.id) unless @statuses.empty?
 
     set_pagination_headers(next_path, prev_path)
   end