Do not use permitted_for scope when querying pinned statuses (#7510)
permitted_for scope is slow when combined with pinned status scope. Fortunately permitted_for scope can safely be removed because a pinned status is always public.pull/486/head^2
parent
55fd55714a
commit
77cd6b5096
|
@ -27,19 +27,17 @@ class Api::V1::Accounts::StatusesController < Api::BaseController
|
||||||
end
|
end
|
||||||
|
|
||||||
def account_statuses
|
def account_statuses
|
||||||
default_statuses.tap do |statuses|
|
statuses = truthy_param?(:pinned) ? pinned_scope : permitted_account_statuses
|
||||||
statuses.merge!(only_media_scope) if truthy_param?(:only_media)
|
statuses = statuses.paginate_by_max_id(
|
||||||
statuses.merge!(pinned_scope) if truthy_param?(:pinned)
|
|
||||||
statuses.merge!(no_replies_scope) if truthy_param?(:exclude_replies)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def default_statuses
|
|
||||||
permitted_account_statuses.paginate_by_max_id(
|
|
||||||
limit_param(DEFAULT_STATUSES_LIMIT),
|
limit_param(DEFAULT_STATUSES_LIMIT),
|
||||||
params[:max_id],
|
params[:max_id],
|
||||||
params[:since_id]
|
params[:since_id]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
statuses.merge!(only_media_scope) if truthy_param?(:only_media)
|
||||||
|
statuses.merge!(no_replies_scope) if truthy_param?(:exclude_replies)
|
||||||
|
|
||||||
|
statuses
|
||||||
end
|
end
|
||||||
|
|
||||||
def permitted_account_statuses
|
def permitted_account_statuses
|
||||||
|
|
Loading…
Reference in New Issue