[#1560] Ensured authentication or enabled federation for federation-related routes...
[akkoma] / lib / pleroma / web / activity_pub / activity_pub.ex
index def4992245356fdc1bd937f0eeea293a168b2e5c..d9f74b6a4928004f074025369bd26183aa517253 100644 (file)
@@ -1,5 +1,5 @@
 # Pleroma: A lightweight social networking server
-# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
+# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
 # SPDX-License-Identifier: AGPL-3.0-only
 
 defmodule Pleroma.Web.ActivityPub.ActivityPub do
@@ -613,7 +613,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
   end
 
   @spec unblock(User.t(), User.t(), String.t() | nil, boolean()) ::
-          {:ok, Activity.t()} | {:error, any()}
+          {:ok, Activity.t()} | {:error, any()} | nil
   def unblock(blocker, blocked, activity_id \\ nil, local \\ true) do
     with {:ok, result} <-
            Repo.transaction(fn -> do_unblock(blocker, blocked, activity_id, local) end) do
@@ -660,7 +660,9 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
          {:ok, activity} <- insert(flag_data, local),
          {:ok, stripped_activity} <- strip_report_status_data(activity),
          :ok <- maybe_federate(stripped_activity) do
-      Enum.each(User.all_superusers(), fn superuser ->
+      User.all_superusers()
+      |> Enum.filter(fn user -> not is_nil(user.email) end)
+      |> Enum.each(fn superuser ->
         superuser
         |> Pleroma.Emails.AdminEmail.report(actor, account, statuses, content)
         |> Pleroma.Emails.Mailer.deliver_async()