X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Femails%2Fadmin_email.ex;h=d0e254362ba60c386582fc3c4f5835da3b36712a;hb=27b9605de05a8d7097852213e8b53b5b4633a8eb;hp=9b20c7e08197f23425612b4b79b54fbac0302933;hpb=54f9e3d38243615da6376338fc85588235586410;p=akkoma
diff --git a/lib/pleroma/emails/admin_email.ex b/lib/pleroma/emails/admin_email.ex
index 9b20c7e08..d0e254362 100644
--- a/lib/pleroma/emails/admin_email.ex
+++ b/lib/pleroma/emails/admin_email.ex
@@ -2,7 +2,7 @@
# Copyright © 2017-2019 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
-defmodule Pleroma.AdminEmail do
+defmodule Pleroma.Emails.AdminEmail do
@moduledoc "Admin emails"
import Swoosh.Email
@@ -11,7 +11,10 @@ defmodule Pleroma.AdminEmail do
defp instance_config, do: Pleroma.Config.get(:instance)
defp instance_name, do: instance_config()[:name]
- defp instance_email, do: instance_config()[: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)
@@ -26,12 +29,16 @@ 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 %{id: id} ->
- status_url = Helpers.o_status_url(Pleroma.Web.Endpoint, :notice, id)
- "
#{status_url}"
+ |> Enum.map(fn
+ %{id: id} ->
+ status_url = Helpers.o_status_url(Pleroma.Web.Endpoint, :notice, id)
+ "#{status_url}"
+
+ id when is_binary(id) ->
+ "#{id}"
end)
|> Enum.join("\n")
@@ -55,7 +62,7 @@ defmodule Pleroma.AdminEmail do
new()
|> to({to.name, to.email})
- |> from({instance_name(), instance_email()})
+ |> from({instance_name(), instance_notify_email()})
|> reply_to({reporter.name, reporter.email})
|> subject("#{instance_name()} Report")
|> html_body(html_body)