# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
-defmodule Pleroma.UserEmail do
+defmodule Pleroma.Emails.UserEmail do
@moduledoc "User emails"
import Swoosh.Email
if user.info.confirmation_pending &&
Pleroma.Config.get([:instance, :account_activation_required]) do
user
- |> Pleroma.UserEmail.account_confirmation_email()
+ |> Pleroma.Emails.UserEmail.account_confirmation_email()
|> Pleroma.Emails.Mailer.deliver_async()
else
{:ok, :noop}
!Pleroma.Config.get([:instance, :registrations_open]),
{:ok, invite_token} <- Pleroma.UserInviteToken.create_token(),
email <-
- Pleroma.UserEmail.user_invitation_email(user, invite_token, email, params["name"]),
+ Pleroma.Emails.UserEmail.user_invitation_email(
+ user,
+ invite_token,
+ email,
+ params["name"]
+ ),
{:ok, _} <- Pleroma.Emails.Mailer.deliver(email) do
json_response(conn, :no_content, "")
end
defmodule Pleroma.Web.TwitterAPI.TwitterAPI do
alias Pleroma.Activity
alias Pleroma.Emails.Mailer
+ alias Pleroma.Emails.UserEmail
alias Pleroma.Repo
alias Pleroma.User
- alias Pleroma.UserEmail
alias Pleroma.UserInviteToken
alias Pleroma.Web.ActivityPub.ActivityPub
alias Pleroma.Web.CommonAPI
refute token_record.used
Swoosh.TestAssertions.assert_email_sent(
- Pleroma.UserEmail.user_invitation_email(
+ Pleroma.Emails.UserEmail.user_invitation_email(
user,
token_record,
recipient_email,
token_record = Repo.get_by(Pleroma.PasswordResetToken, user_id: user.id)
Swoosh.TestAssertions.assert_email_sent(
- Pleroma.UserEmail.password_reset_email(user, token_record.token)
+ Pleroma.Emails.UserEmail.password_reset_email(user, token_record.token)
)
end
end
|> assign(:user, user)
|> post("/api/account/resend_confirmation_email?email=#{user.email}")
- Swoosh.TestAssertions.assert_email_sent(Pleroma.UserEmail.account_confirmation_email(user))
+ Swoosh.TestAssertions.assert_email_sent(
+ Pleroma.Emails.UserEmail.account_confirmation_email(user)
+ )
end
end
assert user.info.confirmation_pending
- Swoosh.TestAssertions.assert_email_sent(Pleroma.UserEmail.account_confirmation_email(user))
+ Swoosh.TestAssertions.assert_email_sent(
+ Pleroma.Emails.UserEmail.account_confirmation_email(user)
+ )
end
test "it registers a new user and parses mentions in the bio" do