s/Pleroma.UserEmail/Pleroma.Emails.UserEmail/

This commit is contained in:
Haelwenn (lanodan) Monnier 2019-04-10 06:14:37 +02:00
parent cae0231731
commit 9c1b36856b
No known key found for this signature in database
GPG Key ID: D5B7A8E43C997DEE
7 changed files with 17 additions and 8 deletions

View File

@ -2,7 +2,7 @@
# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> # Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only # SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.UserEmail do defmodule Pleroma.Emails.UserEmail do
@moduledoc "User emails" @moduledoc "User emails"
import Swoosh.Email import Swoosh.Email

View File

@ -279,7 +279,7 @@ def try_send_confirmation_email(%User{} = user) do
if user.info.confirmation_pending && if user.info.confirmation_pending &&
Pleroma.Config.get([:instance, :account_activation_required]) do Pleroma.Config.get([:instance, :account_activation_required]) do
user user
|> Pleroma.UserEmail.account_confirmation_email() |> Pleroma.Emails.UserEmail.account_confirmation_email()
|> Pleroma.Emails.Mailer.deliver_async() |> Pleroma.Emails.Mailer.deliver_async()
else else
{:ok, :noop} {:ok, :noop}

View File

@ -237,7 +237,12 @@ def email_invite(%{assigns: %{user: user}} = conn, %{"email" => email} = params)
!Pleroma.Config.get([:instance, :registrations_open]), !Pleroma.Config.get([:instance, :registrations_open]),
{:ok, invite_token} <- Pleroma.UserInviteToken.create_token(), {:ok, invite_token} <- Pleroma.UserInviteToken.create_token(),
email <- 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 {:ok, _} <- Pleroma.Emails.Mailer.deliver(email) do
json_response(conn, :no_content, "") json_response(conn, :no_content, "")
end end

View File

@ -5,9 +5,9 @@
defmodule Pleroma.Web.TwitterAPI.TwitterAPI do defmodule Pleroma.Web.TwitterAPI.TwitterAPI do
alias Pleroma.Activity alias Pleroma.Activity
alias Pleroma.Emails.Mailer alias Pleroma.Emails.Mailer
alias Pleroma.Emails.UserEmail
alias Pleroma.Repo alias Pleroma.Repo
alias Pleroma.User alias Pleroma.User
alias Pleroma.UserEmail
alias Pleroma.UserInviteToken alias Pleroma.UserInviteToken
alias Pleroma.Web.ActivityPub.ActivityPub alias Pleroma.Web.ActivityPub.ActivityPub
alias Pleroma.Web.CommonAPI alias Pleroma.Web.CommonAPI

View File

@ -317,7 +317,7 @@ test "sends invitation and returns 204", %{conn: conn, user: user} do
refute token_record.used refute token_record.used
Swoosh.TestAssertions.assert_email_sent( Swoosh.TestAssertions.assert_email_sent(
Pleroma.UserEmail.user_invitation_email( Pleroma.Emails.UserEmail.user_invitation_email(
user, user,
token_record, token_record,
recipient_email, recipient_email,

View File

@ -1064,7 +1064,7 @@ test "it sends an email to user", %{user: user} do
token_record = Repo.get_by(Pleroma.PasswordResetToken, user_id: user.id) token_record = Repo.get_by(Pleroma.PasswordResetToken, user_id: user.id)
Swoosh.TestAssertions.assert_email_sent( 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
end end
@ -1163,7 +1163,9 @@ test "it sends confirmation email", %{conn: conn, user: user} do
|> assign(:user, user) |> assign(:user, user)
|> post("/api/account/resend_confirmation_email?email=#{user.email}") |> 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
end end

View File

@ -321,7 +321,9 @@ test "it sends confirmation email if :account_activation_required is specified i
assert user.info.confirmation_pending 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 end
test "it registers a new user and parses mentions in the bio" do test "it registers a new user and parses mentions in the bio" do