Insert object after being rewritten.
authorlain <lain@soykaf.club>
Sat, 28 Apr 2018 14:10:24 +0000 (16:10 +0200)
committerlain <lain@soykaf.club>
Sat, 28 Apr 2018 14:10:24 +0000 (16:10 +0200)
lib/pleroma/web/activity_pub/activity_pub.ex

index 984d1162d6e9bfd2e2175665a5bfdf3faa923643..3ddc009a1d3fc517d5341942d77abc74ae01eead 100644 (file)
@@ -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)
     )