From: lain Date: Sat, 28 Apr 2018 14:10:24 +0000 (+0200) Subject: Insert object after being rewritten. X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=4d55d7c95e8409f5018f3321d7e653b6349b9ba6;p=akkoma Insert object after being rewritten. --- 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 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub 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 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub 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) )