Merge branch 'fav-speedup' into 'develop'

Fix favorites query performance

See merge request pleroma/pleroma!2591
This commit is contained in:
rinpatch 2020-05-26 16:33:13 +00:00
commit cf139b06a3

View file

@ -24,10 +24,7 @@ defmodule Pleroma.Activity.Queries do
@spec by_actor(query, String.t()) :: query @spec by_actor(query, String.t()) :: query
def by_actor(query \\ Activity, actor) do def by_actor(query \\ Activity, actor) do
from( from(a in query, where: a.actor == ^actor)
activity in query,
where: fragment("(?)->>'actor' = ?", activity.data, ^actor)
)
end end
@spec by_author(query, User.t()) :: query @spec by_author(query, User.t()) :: query