about summary refs log tree commit diff
path: root/app/controllers/api
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/api')
-rw-r--r--app/controllers/api/salmon_controller.rb2
-rw-r--r--app/controllers/api/subscriptions_controller.rb2
-rw-r--r--app/controllers/api/v1/accounts_controller.rb8
-rw-r--r--app/controllers/api/v1/apps_controller.rb2
-rw-r--r--app/controllers/api/v1/follows_controller.rb2
-rw-r--r--app/controllers/api/v1/media_controller.rb2
-rw-r--r--app/controllers/api/v1/statuses_controller.rb8
-rw-r--r--app/controllers/api/v1/timelines_controller.rb10
8 files changed, 26 insertions, 10 deletions
diff --git a/app/controllers/api/salmon_controller.rb b/app/controllers/api/salmon_controller.rb
index c0ba32ff2..01862a900 100644
--- a/app/controllers/api/salmon_controller.rb
+++ b/app/controllers/api/salmon_controller.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 class Api::SalmonController < ApiController
   before_action :set_account
   respond_to :txt
diff --git a/app/controllers/api/subscriptions_controller.rb b/app/controllers/api/subscriptions_controller.rb
index 058ae8f5e..51c476436 100644
--- a/app/controllers/api/subscriptions_controller.rb
+++ b/app/controllers/api/subscriptions_controller.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 class Api::SubscriptionsController < ApiController
   before_action :set_account
   respond_to :txt
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
diff --git a/app/controllers/api/v1/apps_controller.rb b/app/controllers/api/v1/apps_controller.rb
index a09c29cc6..d1db16cf2 100644
--- a/app/controllers/api/v1/apps_controller.rb
+++ b/app/controllers/api/v1/apps_controller.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 class Api::V1::AppsController < ApiController
   respond_to :json
 
diff --git a/app/controllers/api/v1/follows_controller.rb b/app/controllers/api/v1/follows_controller.rb
index 6a77c4d66..c22dacbaa 100644
--- a/app/controllers/api/v1/follows_controller.rb
+++ b/app/controllers/api/v1/follows_controller.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 class Api::V1::FollowsController < ApiController
   before_action -> { doorkeeper_authorize! :follow }
   before_action :require_user!
diff --git a/app/controllers/api/v1/media_controller.rb b/app/controllers/api/v1/media_controller.rb
index 6b93e47b4..bb8e8d9ee 100644
--- a/app/controllers/api/v1/media_controller.rb
+++ b/app/controllers/api/v1/media_controller.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 class Api::V1::MediaController < ApiController
   before_action -> { doorkeeper_authorize! :write }
   before_action :require_user!
diff --git a/app/controllers/api/v1/statuses_controller.rb b/app/controllers/api/v1/statuses_controller.rb
index f5dbbd013..e1a417129 100644
--- a/app/controllers/api/v1/statuses_controller.rb
+++ b/app/controllers/api/v1/statuses_controller.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 class Api::V1::StatusesController < ApiController
   before_action -> { doorkeeper_authorize! :read }, except: [:create, :destroy, :reblog, :unreblog, :favourite, :unfavourite]
   before_action -> { doorkeeper_authorize! :write }, only:  [:create, :destroy, :reblog, :unreblog, :favourite, :unfavourite]
@@ -10,7 +12,7 @@ class Api::V1::StatusesController < ApiController
   end
 
   def context
-    @context = OpenStruct.new({ ancestors: @status.ancestors, descendants: @status.descendants })
+    @context = OpenStruct.new(ancestors: @status.ancestors, descendants: @status.descendants)
     set_maps([@status] + @context[:ancestors] + @context[:descendants])
   end
 
@@ -20,7 +22,7 @@ class Api::V1::StatusesController < ApiController
     @accounts = results.map { |r| accounts[r.account_id] }
 
     next_path = reblogged_by_api_v1_status_url(max_id: results.last.id)    if results.size == DEFAULT_ACCOUNTS_LIMIT
-    prev_path = reblogged_by_api_v1_status_url(since_id: results.first.id) if results.size > 0
+    prev_path = reblogged_by_api_v1_status_url(since_id: results.first.id) unless results.empty?
 
     set_pagination_headers(next_path, prev_path)
 
@@ -33,7 +35,7 @@ class Api::V1::StatusesController < ApiController
     @accounts = results.map { |f| accounts[f.account_id] }
 
     next_path = favourited_by_api_v1_status_url(max_id: results.last.id)    if results.size == DEFAULT_ACCOUNTS_LIMIT
-    prev_path = favourited_by_api_v1_status_url(since_id: results.first.id) if results.size > 0
+    prev_path = favourited_by_api_v1_status_url(since_id: results.first.id) unless results.empty?
 
     set_pagination_headers(next_path, prev_path)
 
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)