From 22cb286ad7fff27d109bad56c54dd35d8b8265d4 Mon Sep 17 00:00:00 2001 From: Akihiko Odaki Date: Sun, 21 May 2017 00:48:34 +0900 Subject: Fix regressions in api/v1 (#3178) The regressions are introduced at commit f55480756337dd4df7513e89673e81e003f1201a by me (Akihiko Odaki) --- app/controllers/api/v1/statuses_controller.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'app/controllers/api/v1/statuses_controller.rb') diff --git a/app/controllers/api/v1/statuses_controller.rb b/app/controllers/api/v1/statuses_controller.rb index 1fead10e7..1ed51aabf 100644 --- a/app/controllers/api/v1/statuses_controller.rb +++ b/app/controllers/api/v1/statuses_controller.rb @@ -32,14 +32,14 @@ class Api::V1::StatusesController < ApiController end def reblogged_by - @accounts = Account.includes(statuses: :reblogs) - .references(statuses: :reblogs) - .where(statuses: { id: @status.id }) - .merge(@status.reblogs.paginate_by_max_id(limit_param(DEFAULT_ACCOUNTS_LIMIT), params[:max_id], params[:since_id])) + @accounts = Account.includes(:statuses) + .references(:statuses) + .merge(Status.where(reblog_of_id: @status.id) + .paginate_by_max_id(limit_param(DEFAULT_ACCOUNTS_LIMIT), params[:max_id], params[:since_id])) .to_a - next_path = reblogged_by_api_v1_status_url(pagination_params(max_id: @accounts.last.statuses.last.reblogs.last.id)) if @accounts.size == limit_param(DEFAULT_ACCOUNTS_LIMIT) - prev_path = reblogged_by_api_v1_status_url(pagination_params(since_id: @accounts.first.statuses.first.reblogs.first.id)) unless @accounts.empty? + next_path = reblogged_by_api_v1_status_url(pagination_params(max_id: @accounts.last.statuses.last.id)) if @accounts.size == limit_param(DEFAULT_ACCOUNTS_LIMIT) + prev_path = reblogged_by_api_v1_status_url(pagination_params(since_id: @accounts.first.statuses.first.id)) unless @accounts.empty? set_pagination_headers(next_path, prev_path) -- cgit