1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.AdminEmail do
6 @moduledoc "Admin emails"
10 alias Pleroma.Web.Router.Helpers
12 defp instance_config, do: Pleroma.Config.get(:instance)
13 defp instance_name, do: instance_config()[:name]
15 defp instance_notify_email do
16 Keyword.get(instance_config(), :notify_email, instance_config()[:email])
19 defp user_url(user) do
20 Helpers.o_status_url(Pleroma.Web.Endpoint, :feed_redirect, user.nickname)
23 def report(to, reporter, account, statuses, comment) do
26 "<p>Comment: #{comment}"
32 if length(statuses) > 0 do
37 status_url = Helpers.o_status_url(Pleroma.Web.Endpoint, :notice, id)
38 "<li><a href=\"#{status_url}\">#{status_url}</li>"
40 id when is_binary(id) ->
41 "<li><a href=\"#{id}\">#{id}</li>"
57 <p>Reported by: <a href="#{user_url(reporter)}">#{reporter.nickname}</a></p>
58 <p>Reported Account: <a href="#{user_url(account)}">#{account.nickname}</a></p>
64 |> to({to.name, to.email})
65 |> from({instance_name(), instance_notify_email()})
66 |> reply_to({reporter.name, reporter.email})
67 |> subject("#{instance_name()} Report")
68 |> html_body(html_body)