Simplify query.

stable
Roger Braun 7 years ago
parent b4f055b604
commit a17b261379

@ -118,11 +118,8 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
defp restrict_tag(query, _), do: query defp restrict_tag(query, _), do: query
defp restrict_recipients(query, recipients) do defp restrict_recipients(query, recipients) do
Enum.reduce(recipients, query, fn (recipient, q) -> from activity in query,
map = %{ to: [recipient] } where: fragment("?->'to' \\\?| ? ", activity.data, ^recipients)
from activity in q,
or_where: fragment(~s(? @> ?), activity.data, ^map)
end)
end end
defp restrict_local(query, %{"local_only" => true}) do defp restrict_local(query, %{"local_only" => true}) do

Loading…
Cancel
Save