reports: unify sending e-mail for both remote and local reports
authorWilliam Pitcock <nenolod@dereferenced.org>
Thu, 14 Mar 2019 19:38:46 +0000 (19:38 +0000)
committerWilliam Pitcock <nenolod@dereferenced.org>
Thu, 14 Mar 2019 19:44:08 +0000 (19:44 +0000)
lib/pleroma/web/activity_pub/activity_pub.ex
lib/pleroma/web/common_api/common_api.ex

index 7d21fe65f7ff4c0ee588495cd1328a7dcba8daf3..32f69e0fa6f0380b1ca23c8a1fc5a25a9f08a6a5 100644 (file)
@@ -394,6 +394,12 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
     with flag_data <- make_flag_data(params, additional),
          {:ok, activity} <- insert(flag_data, local),
          :ok <- maybe_federate(activity) do
+      Enum.each(User.all_superusers(), fn superuser ->
+        superuser
+        |> Pleroma.AdminEmail.report(actor, account, statuses, content)
+        |> Pleroma.Mailer.deliver_async()
+      end)
+
       {:ok, activity}
     end
   end
index ead4928b5fd0c1781c78c97d26473cfd6f1d9af2..edbcd33978afaf7b9fe061d1d3bc799299651d3a 100644 (file)
@@ -287,12 +287,6 @@ defmodule Pleroma.Web.CommonAPI do
              content: content_html,
              forward: data["forward"] || false
            }) do
-      Enum.each(User.all_superusers(), fn superuser ->
-        superuser
-        |> Pleroma.AdminEmail.report(user, account, statuses, content_html)
-        |> Pleroma.Mailer.deliver_async()
-      end)
-
       {:ok, activity}
     else
       {:error, err} -> {:error, err}