mirror of https://github.com/tootsuite/mastodon
Revert to not indexing by id
parent
69253d65c8
commit
6b20cfdab4
|
@ -22,7 +22,7 @@ class Api::V1::AccountsController < Api::BaseController
|
||||||
override_rate_limit_headers :follow, family: :follows
|
override_rate_limit_headers :follow, family: :follows
|
||||||
|
|
||||||
def index
|
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
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
|
|
|
@ -27,7 +27,7 @@ class Api::V1::StatusesController < Api::BaseController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@statuses = cache_collection(@statuses, Status)
|
@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
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
|
|
|
@ -17,9 +17,9 @@ describe '/api/v1/accounts' do
|
||||||
get '/api/v1/accounts', headers: headers, params: { ids: [account.id, other_account.id, 123_123] }
|
get '/api/v1/accounts', headers: headers, params: { ids: [account.id, other_account.id, 123_123] }
|
||||||
|
|
||||||
expect(response).to have_http_status(200)
|
expect(response).to have_http_status(200)
|
||||||
expect(body_as_json.with_indifferent_access).to include(
|
expect(body_as_json).to contain_exactly(
|
||||||
account.id.to_s.to_s => include(id: account.id.to_s),
|
hash_including(id: account.id.to_s),
|
||||||
other_account.id.to_s => include(id: other_account.id.to_s)
|
hash_including(id: other_account.id.to_s)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -18,9 +18,9 @@ describe '/api/v1/statuses' do
|
||||||
get '/api/v1/statuses', headers: headers, params: { ids: [status.id, other_status.id, 123_123] }
|
get '/api/v1/statuses', headers: headers, params: { ids: [status.id, other_status.id, 123_123] }
|
||||||
|
|
||||||
expect(response).to have_http_status(200)
|
expect(response).to have_http_status(200)
|
||||||
expect(body_as_json.with_indifferent_access).to include(
|
expect(body_as_json).to contain_exactly(
|
||||||
status.id.to_s => include(id: status.id.to_s),
|
hash_including(id: status.id.to_s),
|
||||||
other_status.id.to_s => include(id: other_status.id.to_s)
|
hash_including(id: other_status.id.to_s)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue