Merge branch 'develop' into 'feature/custom-runtime-modules'
[akkoma] / lib / pleroma / emails / admin_email.ex
index 59d571c2a6fd69a3eb3bf996efd72dbc65d6aade..b15e4041bd4295d17d3a6a5124748ff87c60778a 100644 (file)
@@ -2,7 +2,7 @@
 # Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
 # SPDX-License-Identifier: AGPL-3.0-only
 
-defmodule Pleroma.AdminEmail do
+defmodule Pleroma.Emails.AdminEmail do
   @moduledoc "Admin emails"
 
   import Swoosh.Email
@@ -11,10 +11,13 @@ defmodule Pleroma.AdminEmail do
 
   defp instance_config, do: Pleroma.Config.get(:instance)
   defp instance_name, do: instance_config()[:name]
-  defp instance_notify_email, do: instance_config()[:notify_email]
+
+  defp instance_notify_email do
+    Keyword.get(instance_config(), :notify_email, instance_config()[:email])
+  end
 
   defp user_url(user) do
-    Helpers.o_status_url(Pleroma.Web.Endpoint, :feed_redirect, user.nickname)
+    Helpers.feed_url(Pleroma.Web.Endpoint, :feed_redirect, user.id)
   end
 
   def report(to, reporter, account, statuses, comment) do
@@ -26,7 +29,7 @@ defmodule Pleroma.AdminEmail do
       end
 
     statuses_html =
-      if length(statuses) > 0 do
+      if is_list(statuses) && length(statuses) > 0 do
         statuses_list_html =
           statuses
           |> Enum.map(fn
@@ -60,7 +63,6 @@ defmodule Pleroma.AdminEmail do
     new()
     |> to({to.name, to.email})
     |> from({instance_name(), instance_notify_email()})
-    |> reply_to({reporter.name, reporter.email})
     |> subject("#{instance_name()} Report")
     |> html_body(html_body)
   end