mirror of
https://github.com/mastodon/mastodon.git
synced 2025-09-06 18:01:05 +00:00
Extract results methods
This commit is contained in:
parent
914f6b411a
commit
acf034d323
|
@ -20,8 +20,6 @@ class Api::V1::Statuses::ContextsController < Api::BaseController
|
||||||
def show
|
def show
|
||||||
cache_if_unauthenticated!
|
cache_if_unauthenticated!
|
||||||
|
|
||||||
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)
|
|
||||||
loaded_ancestors = preload_collection(ancestors_results, Status)
|
loaded_ancestors = preload_collection(ancestors_results, Status)
|
||||||
loaded_descendants = preload_collection(descendants_results, Status)
|
loaded_descendants = preload_collection(descendants_results, Status)
|
||||||
|
|
||||||
|
@ -47,6 +45,14 @@ class Api::V1::Statuses::ContextsController < Api::BaseController
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def ancestors_results
|
||||||
|
@status.in_reply_to_id.nil? ? [] : @status.ancestors(ancestors_limit, current_account)
|
||||||
|
end
|
||||||
|
|
||||||
|
def descendants_results
|
||||||
|
@status.descendants(descendants_limit, current_account, descendants_depth_limit)
|
||||||
|
end
|
||||||
|
|
||||||
def ancestors_limit
|
def ancestors_limit
|
||||||
current_account.present? ? CONTEXT_LIMIT : ANCESTORS_LIMIT
|
current_account.present? ? CONTEXT_LIMIT : ANCESTORS_LIMIT
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user