From 4d55d7c95e8409f5018f3321d7e653b6349b9ba6 Mon Sep 17 00:00:00 2001 From: lain Date: Sat, 28 Apr 2018 16:10:24 +0200 Subject: [PATCH] Insert object after being rewritten. --- lib/pleroma/web/activity_pub/activity_pub.ex | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index 984d1162d..3ddc009a1 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -20,8 +20,8 @@ def get_recipients(data) do def insert(map, local \\ true) when is_map(map) do with nil <- Activity.get_by_ap_id(map["id"]), map <- lazy_put_activity_defaults(map), - :ok <- insert_full_object(map), - {:ok, map} <- @rewrite_policy.filter(map) do + {:ok, map} <- @rewrite_policy.filter(map), + :ok <- insert_full_object(map) do {:ok, activity} = Repo.insert(%Activity{ data: map, @@ -313,7 +313,9 @@ defp restrict_recent(query, _) do defp restrict_blocked(query, %{"blocking_user" => %User{info: info}}) do blocks = info["blocks"] || [] - from(activity in query, + + from( + activity in query, where: fragment("not (? = ANY(?))", activity.actor, ^blocks), where: fragment("not (?->'to' \\?| ?)", activity.data, ^blocks) )