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]
14 defp instance_email, do: instance_config()[:email]
16 defp user_url(user) do
17 Helpers.o_status_url(Pleroma.Web.Endpoint, :feed_redirect, user.nickname)
20 def report(to, reporter, account, statuses, comment) do
23 "<p>Comment: #{comment}"
29 if length(statuses) > 0 do
34 status_url = Helpers.o_status_url(Pleroma.Web.Endpoint, :notice, id)
35 "<li><a href=\"#{status_url}\">#{status_url}</li>"
37 id when is_binary(id) ->
38 "<li><a href=\"#{id}\">#{id}</li>"
54 <p>Reported by: <a href="#{user_url(reporter)}">#{reporter.nickname}</a></p>
55 <p>Reported Account: <a href="#{user_url(account)}">#{account.nickname}</a></p>
61 |> to({to.name, to.email})
62 |> from({instance_name(), instance_email()})
63 |> reply_to({reporter.name, reporter.email})
64 |> subject("#{instance_name()} Report")
65 |> html_body(html_body)