summaryrefslogtreecommitdiff
path: root/lib/pleroma/emails
diff options
context:
space:
mode:
Diffstat (limited to 'lib/pleroma/emails')
-rw-r--r--lib/pleroma/emails/admin_email.ex4
-rw-r--r--lib/pleroma/emails/user_email.ex11
2 files changed, 11 insertions, 4 deletions
diff --git a/lib/pleroma/emails/admin_email.ex b/lib/pleroma/emails/admin_email.ex
index 5fe74e2f7..88bc78aec 100644
--- a/lib/pleroma/emails/admin_email.ex
+++ b/lib/pleroma/emails/admin_email.ex
@@ -73,7 +73,7 @@ defmodule Pleroma.Emails.AdminEmail do
#{comment_html}
#{statuses_html}
<p>
- <a href="#{Pleroma.Web.base_url()}/pleroma/admin/#/reports/index">View Reports in AdminFE</a>
+ <a href="#{Pleroma.Web.Endpoint.url()}/pleroma/admin/#/reports/index">View Reports in AdminFE</a>
"""
new()
@@ -87,7 +87,7 @@ defmodule Pleroma.Emails.AdminEmail do
html_body = """
<p>New account for review: <a href="#{account.ap_id}">@#{account.nickname}</a></p>
<blockquote>#{HTML.strip_tags(account.registration_reason)}</blockquote>
- <a href="#{Pleroma.Web.base_url()}/pleroma/admin/#/users/#{account.id}/">Visit AdminFE</a>
+ <a href="#{Pleroma.Web.Endpoint.url()}/pleroma/admin/#/users/#{account.id}/">Visit AdminFE</a>
"""
new()
diff --git a/lib/pleroma/emails/user_email.ex b/lib/pleroma/emails/user_email.ex
index 52f3d419d..e38c681ba 100644
--- a/lib/pleroma/emails/user_email.ex
+++ b/lib/pleroma/emails/user_email.ex
@@ -5,15 +5,22 @@
defmodule Pleroma.Emails.UserEmail do
@moduledoc "User emails"
- use Phoenix.Swoosh, view: Pleroma.Web.EmailView, layout: {Pleroma.Web.LayoutView, :email}
-
alias Pleroma.Config
alias Pleroma.User
alias Pleroma.Web.Endpoint
alias Pleroma.Web.Router
+ import Swoosh.Email
+ import Phoenix.Swoosh, except: [render_body: 3]
import Pleroma.Config.Helpers, only: [instance_name: 0, sender: 0]
+ def render_body(email, template, assigns \\ %{}) do
+ email
+ |> put_new_layout({Pleroma.Web.LayoutView, :email})
+ |> put_new_view(Pleroma.Web.EmailView)
+ |> Phoenix.Swoosh.render_body(template, assigns)
+ end
+
defp recipient(email, nil), do: email
defp recipient(email, name), do: {name, email}
defp recipient(%User{} = user), do: recipient(user.email, user.name)