summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2024-04-24 15:07:20 +0200
committerClaire <claire.github-309c@sitedethib.com>2024-04-24 15:07:45 +0200
commit6b20cfdab44ad6858423ed47d6eaad2f18e57039 (patch)
treec8b54568c8d13b5cb02c0d5cde9e6d497aa3bdde
parent69253d65c8b11fe578e3dcb41e3e93c449619dd1 (diff)
-rw-r--r--app/controllers/api/v1/accounts_controller.rb2
-rw-r--r--app/controllers/api/v1/statuses_controller.rb2
-rw-r--r--spec/requests/api/v1/accounts_spec.rb6
-rw-r--r--spec/requests/api/v1/statuses_spec.rb6
4 files changed, 8 insertions, 8 deletions
diff --git a/app/controllers/api/v1/accounts_controller.rb b/app/controllers/api/v1/accounts_controller.rb
index 95540199fcd..be7b302d3be 100644
--- a/app/controllers/api/v1/accounts_controller.rb
+++ b/app/controllers/api/v1/accounts_controller.rb
@@ -22,7 +22,7 @@ class Api::V1::AccountsController < Api::BaseController
override_rate_limit_headers :follow, family: :follows
def index
- render json: @accounts.map { |account| ActiveModelSerializers::SerializableResource.new(account, serializer: REST::AccountSerializer, scope: current_user, scope_name: :current_user).as_json }.index_by { |account| account[:id] }
+ render json: @accounts, each_serializer: REST::AccountSerializer
end
def show
diff --git a/app/controllers/api/v1/statuses_controller.rb b/app/controllers/api/v1/statuses_controller.rb
index fb99d3de7f7..36a9ec6325b 100644
--- a/app/controllers/api/v1/statuses_controller.rb
+++ b/app/controllers/api/v1/statuses_controller.rb
@@ -27,7 +27,7 @@ class Api::V1::StatusesController < Api::BaseController
def index
@statuses = cache_collection(@statuses, Status)
- render json: @statuses.map { |status| ActiveModelSerializers::SerializableResource.new(status, serializer: REST::StatusSerializer, scope: current_user, scope_name: :current_user).as_json }.index_by { |status| status[:id] }
+ render json: @statuses, each_serializer: REST::StatusSerializer
end
def show
diff --git a/spec/requests/api/v1/accounts_spec.rb b/spec/requests/api/v1/accounts_spec.rb
index f11df1335b1..55f8e1c6fa7 100644
--- a/spec/requests/api/v1/accounts_spec.rb
+++ b/spec/requests/api/v1/accounts_spec.rb
@@ -17,9 +17,9 @@ describe '/api/v1/accounts' do
get '/api/v1/accounts', headers: headers, params: { ids: [account.id, other_account.id, 123_123] }
expect(response).to have_http_status(200)
- expect(body_as_json.with_indifferent_access).to include(
- account.id.to_s.to_s => include(id: account.id.to_s),
- other_account.id.to_s => include(id: other_account.id.to_s)
+ expect(body_as_json).to contain_exactly(
+ hash_including(id: account.id.to_s),
+ hash_including(id: other_account.id.to_s)
)
end
end
diff --git a/spec/requests/api/v1/statuses_spec.rb b/spec/requests/api/v1/statuses_spec.rb
index 6bba414f70a..0b2d1f90cfa 100644
--- a/spec/requests/api/v1/statuses_spec.rb
+++ b/spec/requests/api/v1/statuses_spec.rb
@@ -18,9 +18,9 @@ describe '/api/v1/statuses' do
get '/api/v1/statuses', headers: headers, params: { ids: [status.id, other_status.id, 123_123] }
expect(response).to have_http_status(200)
- expect(body_as_json.with_indifferent_access).to include(
- status.id.to_s => include(id: status.id.to_s),
- other_status.id.to_s => include(id: other_status.id.to_s)
+ expect(body_as_json).to contain_exactly(
+ hash_including(id: status.id.to_s),
+ hash_including(id: other_status.id.to_s)
)
end
end