Merge remote-tracking branch 'parent/main' into upstream-20240517
This commit is contained in:
commit
094ff9d2ee
153 changed files with 1412 additions and 631 deletions
|
@ -26,13 +26,13 @@ class Api::V1::StatusesController < Api::BaseController
|
|||
DESCENDANTS_DEPTH_LIMIT = 20
|
||||
|
||||
def index
|
||||
@statuses = cache_collection(@statuses, Status)
|
||||
@statuses = preload_collection(@statuses, Status)
|
||||
render json: @statuses, each_serializer: REST::StatusSerializer
|
||||
end
|
||||
|
||||
def show
|
||||
cache_if_unauthenticated!
|
||||
@status = cache_collection([@status], Status).first
|
||||
@status = preload_collection([@status], Status).first
|
||||
render json: @status, serializer: REST::StatusSerializer
|
||||
end
|
||||
|
||||
|
@ -52,9 +52,9 @@ class Api::V1::StatusesController < Api::BaseController
|
|||
ancestors_results = @status.in_reply_to_id.nil? ? [] : @status.ancestors(ancestors_limit, current_account)
|
||||
descendants_results = @status.descendants(descendants_limit, current_account, descendants_depth_limit)
|
||||
references_results = @status.readable_references(current_account)
|
||||
loaded_ancestors = cache_collection(ancestors_results, Status)
|
||||
loaded_descendants = cache_collection(descendants_results, Status)
|
||||
loaded_references = cache_collection(references_results, Status)
|
||||
loaded_ancestors = preload_collection(ancestors_results, Status)
|
||||
loaded_descendants = preload_collection(descendants_results, Status)
|
||||
loaded_references = preload_collection(references_results, Status)
|
||||
|
||||
if params[:with_reference]
|
||||
loaded_references.reject! { |status| loaded_ancestors.any? { |ancestor| ancestor.id == status.id } }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue