Skip to content

Commit cac884f

Browse files
abcangGargron
authored andcommitted
Improve account media query (mastodon#10121)
1 parent 7bf7d22 commit cac884f

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

app/controllers/api/v1/accounts/statuses_controller.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ def account_media_status_ids
5151
# Also, Avoid getting slow by not narrowing down by `statuses.account_id`.
5252
# When narrowing down by `statuses.account_id`, `index_statuses_20180106` will be used
5353
# and the table will be joined by `Merge Semi Join`, so the query will be slow.
54-
Status.joins(:media_attachments).merge(@account.media_attachments).permitted_for(@account, current_account)
55-
.paginate_by_max_id(limit_param(DEFAULT_STATUSES_LIMIT), params[:max_id], params[:since_id])
56-
.reorder(id: :desc).distinct(:id).pluck(:id)
54+
@account.statuses.joins(:media_attachments).merge(@account.media_attachments).permitted_for(@account, current_account)
55+
.paginate_by_max_id(limit_param(DEFAULT_STATUSES_LIMIT), params[:max_id], params[:since_id])
56+
.reorder(id: :desc).distinct(:id).pluck(:id)
5757
end
5858

5959
def pinned_scope

0 commit comments

Comments
 (0)