activitypub: allow skipping preload in some cases (like certain tests where the preload is obnoxious)
This commit is contained in:
parent
ba7299fc87
commit
73efe95368
2 changed files with 29 additions and 10 deletions
|
|
@ -718,6 +718,13 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
|
|||
|
||||
defp restrict_muted_reblogs(query, _), do: query
|
||||
|
||||
defp maybe_preload_objects(query, %{"skip_preload" => true}), do: query
|
||||
|
||||
defp maybe_preload_objects(query, _) do
|
||||
query
|
||||
|> Activity.with_preloaded_object()
|
||||
end
|
||||
|
||||
def fetch_activities_query(recipients, opts \\ %{}) do
|
||||
base_query =
|
||||
from(
|
||||
|
|
@ -725,9 +732,9 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
|
|||
limit: 20,
|
||||
order_by: [fragment("? desc nulls last", activity.id)]
|
||||
)
|
||||
|> Activity.with_preloaded_object()
|
||||
|
||||
base_query
|
||||
|> maybe_preload_objects(opts)
|
||||
|> restrict_recipients(recipients, opts["user"])
|
||||
|> restrict_tag(opts)
|
||||
|> restrict_tag_reject(opts)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue