diff options
author | Haelwenn <contact+git.pleroma.social@hacktivis.me> | 2021-08-08 14:37:15 +0000 |
---|---|---|
committer | Haelwenn <contact+git.pleroma.social@hacktivis.me> | 2021-08-08 14:37:15 +0000 |
commit | dc63aaf84f07a6f8042f43617d8ec356fed85cec (patch) | |
tree | 5d12a05bce5dc1a23736fd37e7ca8c64580acd34 /lib/pleroma/emails | |
parent | b221d77a6da07c684bdbc63ddf4500e0d7ffeae8 (diff) | |
parent | 0910777d41f8b4b3096c35c5fc97fc357e5d8c8c (diff) | |
download | pleroma-2.4.0.tar.gz |
Merge branch 'release/2.4.0' into 'stable'v2.4.0
Release/2.4.0
See merge request pleroma/pleroma!3493
Diffstat (limited to 'lib/pleroma/emails')
-rw-r--r-- | lib/pleroma/emails/admin_email.ex | 4 | ||||
-rw-r--r-- | lib/pleroma/emails/user_email.ex | 11 |
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) |