ActivityPub: Use recipients fields.
authorlain <lain@soykaf.club>
Thu, 15 Feb 2018 19:32:07 +0000 (20:32 +0100)
committerlain <lain@soykaf.club>
Thu, 15 Feb 2018 19:32:07 +0000 (20:32 +0100)
lib/pleroma/web/activity_pub/activity_pub.ex

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