Fix referred_by api returns permitted status only
This commit is contained in:
parent
d773c74b9e
commit
95d65c971c
1 changed files with 15 additions and 4 deletions
|
@ -19,15 +19,26 @@ class Api::V1::Statuses::ReferredByStatusesController < Api::BaseController
|
||||||
end
|
end
|
||||||
|
|
||||||
def cached_references
|
def cached_references
|
||||||
cache_collection(results, Status)
|
results
|
||||||
end
|
end
|
||||||
|
|
||||||
def results
|
def results
|
||||||
@results ||= Status.where(id: @status.referenced_by_status_objects.select(:status_id), visibility: [:public, :public_unlisted, :unlisted, :login]).paginate_by_max_id(
|
return @results if @results
|
||||||
|
|
||||||
|
account = current_user&.account
|
||||||
|
statuses = Status.where(id: @status.referenced_by_status_objects.select(:status_id))
|
||||||
|
account_ids = statuses.map(&:account_id).uniq
|
||||||
|
domains = statuses.filter_map(&:account_domain).uniq
|
||||||
|
relations = account&.relations_map(account_ids, domains) || {}
|
||||||
|
|
||||||
|
statuses = cache_collection_paginated_by_id(
|
||||||
|
statuses,
|
||||||
|
Status,
|
||||||
limit_param(DEFAULT_STATUSES_LIMIT),
|
limit_param(DEFAULT_STATUSES_LIMIT),
|
||||||
params[:max_id],
|
params_slice(:max_id, :since_id, :min_id)
|
||||||
params[:since_id]
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@results = statuses.filter { |status| !StatusFilter.new(status, account, relations).filtered? }
|
||||||
end
|
end
|
||||||
|
|
||||||
def insert_pagination_headers
|
def insert_pagination_headers
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue