From 9c1b36856b97a7f86e60ad23ef374449c1910c7a Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Wed, 10 Apr 2019 06:14:37 +0200 Subject: [PATCH] s/Pleroma.UserEmail/Pleroma.Emails.UserEmail/ --- lib/pleroma/emails/user_email.ex | 2 +- lib/pleroma/user.ex | 2 +- lib/pleroma/web/admin_api/admin_api_controller.ex | 7 ++++++- lib/pleroma/web/twitter_api/twitter_api.ex | 2 +- test/web/admin_api/admin_api_controller_test.exs | 2 +- test/web/twitter_api/twitter_api_controller_test.exs | 6 ++++-- test/web/twitter_api/twitter_api_test.exs | 4 +++- 7 files changed, 17 insertions(+), 8 deletions(-) diff --git a/lib/pleroma/emails/user_email.ex b/lib/pleroma/emails/user_email.ex index a3a09e96c..f475ebb9f 100644 --- a/lib/pleroma/emails/user_email.ex +++ b/lib/pleroma/emails/user_email.ex @@ -2,7 +2,7 @@ # Copyright © 2017-2019 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.UserEmail do +defmodule Pleroma.Emails.UserEmail do @moduledoc "User emails" import Swoosh.Email diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index 8cf69c591..0d25cf74c 100644 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@ -279,7 +279,7 @@ def try_send_confirmation_email(%User{} = user) do 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} diff --git a/lib/pleroma/web/admin_api/admin_api_controller.ex b/lib/pleroma/web/admin_api/admin_api_controller.ex index 3679b502b..3366e7275 100644 --- a/lib/pleroma/web/admin_api/admin_api_controller.ex +++ b/lib/pleroma/web/admin_api/admin_api_controller.ex @@ -237,7 +237,12 @@ def email_invite(%{assigns: %{user: user}} = conn, %{"email" => email} = params) !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 diff --git a/lib/pleroma/web/twitter_api/twitter_api.ex b/lib/pleroma/web/twitter_api/twitter_api.ex index bf216a18f..a69bd0a54 100644 --- a/lib/pleroma/web/twitter_api/twitter_api.ex +++ b/lib/pleroma/web/twitter_api/twitter_api.ex @@ -5,9 +5,9 @@ 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 diff --git a/test/web/admin_api/admin_api_controller_test.exs b/test/web/admin_api/admin_api_controller_test.exs index ca6bd0e97..2a8791b83 100644 --- a/test/web/admin_api/admin_api_controller_test.exs +++ b/test/web/admin_api/admin_api_controller_test.exs @@ -317,7 +317,7 @@ test "sends invitation and returns 204", %{conn: conn, user: user} do 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, diff --git a/test/web/twitter_api/twitter_api_controller_test.exs b/test/web/twitter_api/twitter_api_controller_test.exs index 72b7ea85e..b3e01e943 100644 --- a/test/web/twitter_api/twitter_api_controller_test.exs +++ b/test/web/twitter_api/twitter_api_controller_test.exs @@ -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) 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 @@ -1163,7 +1163,9 @@ test "it sends confirmation email", %{conn: conn, user: user} do |> 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 diff --git a/test/web/twitter_api/twitter_api_test.exs b/test/web/twitter_api/twitter_api_test.exs index 6c00244de..fcb3fd8bd 100644 --- a/test/web/twitter_api/twitter_api_test.exs +++ b/test/web/twitter_api/twitter_api_test.exs @@ -321,7 +321,9 @@ test "it sends confirmation email if :account_activation_required is specified i 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