From 38f3908c14d3b8fcfe522d4c92bde022dcc682e3 Mon Sep 17 00:00:00 2001 From: Roger Braun Date: Thu, 19 Oct 2017 17:56:27 +0200 Subject: [PATCH] Revert "Simplify query." This reverts commit a17b2613795b24162e953dd457b411dddc0c902e. --- lib/pleroma/web/activity_pub/activity_pub.ex | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index 7a1566156..31aa2c4f1 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -118,8 +118,11 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do defp restrict_tag(query, _), do: query defp restrict_recipients(query, recipients) do - from activity in query, - where: fragment("?->'to' \\\?| ? ", activity.data, ^recipients) + Enum.reduce(recipients, query, fn (recipient, q) -> + map = %{ to: [recipient] } + from activity in q, + or_where: fragment(~s(? @> ?), activity.data, ^map) + end) end defp restrict_local(query, %{"local_only" => true}) do -- 2.45.2