Revert "Simplify query."

This reverts commit a17b261379.
This commit is contained in:
Roger Braun 2017-10-19 17:56:27 +02:00
parent 6af164f27b
commit 38f3908c14

View file

@ -118,8 +118,11 @@ 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
from activity in query, Enum.reduce(recipients, query, fn (recipient, q) ->
where: fragment("?->'to' \\\?| ? ", activity.data, ^recipients) map = %{ to: [recipient] }
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