Correct email links to be absolute URLs

This commit is contained in:
FloatingGhost 2023-11-02 11:49:03 +00:00
parent fb700a956a
commit 6cc523bd23
2 changed files with 7 additions and 7 deletions

View file

@ -74,7 +74,7 @@ def welcome(user, opts \\ %{}) do
def password_reset_email(user, token) when is_binary(token) do
Gettext.with_locale_or_default user.language do
password_reset_url = ~p[/api/v1/pleroma/password_reset/#{token}]
password_reset_url = url(~p[/api/v1/pleroma/password_reset/#{token}])
html_body =
Gettext.dpgettext(
@ -107,7 +107,7 @@ def user_invitation_email(
to_name \\ nil
) do
Gettext.with_locale_or_default user.language do
registration_url = ~p[/registration/#{user_invite_token.token}]
registration_url = url(~p[/registration/#{user_invite_token.token}])
html_body =
Gettext.dpgettext(
@ -140,7 +140,7 @@ def user_invitation_email(
def account_confirmation_email(user) do
Gettext.with_locale_or_default user.language do
confirmation_url = ~p[/api/account/confirm_email/#{user.id}/#{user.confirmation_token}]
confirmation_url = url(~p[/api/account/confirm_email/#{user.id}/#{user.confirmation_token}])
html_body =
Gettext.dpgettext(
@ -330,7 +330,7 @@ def unsubscribe_url(user, notifications_type) do
|> Pleroma.JWT.generate_and_sign!()
|> Base.encode64()
~p[/mailer/unsubscribe/#{token}]
url(~p[/mailer/unsubscribe/#{token}])
end
def backup_is_ready_email(backup, admin_user_id \\ nil) do

View file

@ -16,7 +16,7 @@ test "build password reset email" do
assert email.from == {config[:name], config[:notify_email]}
assert email.to == [{user.name, user.email}]
assert email.subject == "Password reset"
assert email.html_body =~ ~p"/api/v1/pleroma/password_reset/test_token"
assert email.html_body =~ url(~p"/api/v1/pleroma/password_reset/test_token")
end
test "build user invitation email" do
@ -28,7 +28,7 @@ test "build user invitation email" do
assert email.subject == "Invitation to Akkoma"
assert email.to == [{"Jonh", "test@test.com"}]
assert email.html_body =~ ~p[/registration/#{token.token}]
assert email.html_body =~ url(~p[/registration/#{token.token}])
end
test "build account confirmation email" do
@ -39,7 +39,7 @@ test "build account confirmation email" do
assert email.to == [{user.name, user.email}]
assert email.subject == "#{config[:name]} account confirmation"
assert email.html_body =~ ~p[/account/confirm_email/#{user.id}/conf-token]
assert email.html_body =~ url(~p[/api/account/confirm_email/#{user.id}/conf-token])
end
test "build approval pending email" do