From 18b9467d1a63766123f625a964303f6b4d28a39f Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Thu, 13 Dec 2018 16:22:42 +0300 Subject: [PATCH] [#114] Removed `email_invite` implementation (to be addressed separately). --- .../web/twitter_api/twitter_api_controller.ex | 8 +---- .../twitter_api_controller_test.exs | 32 ------------------- 2 files changed, 1 insertion(+), 39 deletions(-) diff --git a/lib/pleroma/web/twitter_api/twitter_api_controller.ex b/lib/pleroma/web/twitter_api/twitter_api_controller.ex index d51d71299..a45fdcf51 100644 --- a/lib/pleroma/web/twitter_api/twitter_api_controller.ex +++ b/lib/pleroma/web/twitter_api/twitter_api_controller.ex @@ -335,13 +335,7 @@ def password_reset(conn, params) do def confirm_email(_conn, _params), do: :noop - def email_invite(%{assigns: %{user: user}} = conn, %{"email" => email} = params) do - with true <- Pleroma.Config.get([:instance, :invites_enabled]), - email <- Pleroma.UserEmail.user_invitation_email(user, email, params["name"]), - {:ok, _} <- Pleroma.Mailer.deliver(email) do - json_response(conn, :no_content, "") - end - end + def email_invite(_conn, _params), do: :noop def update_avatar(%{assigns: %{user: user}} = conn, params) do {:ok, object} = ActivityPub.upload(params, type: :avatar) diff --git a/test/web/twitter_api/twitter_api_controller_test.exs b/test/web/twitter_api/twitter_api_controller_test.exs index cbb5f7796..c16c0cdc0 100644 --- a/test/web/twitter_api/twitter_api_controller_test.exs +++ b/test/web/twitter_api/twitter_api_controller_test.exs @@ -873,38 +873,6 @@ test "it returns 500 when user is not local", %{conn: conn, user: user} do end end - describe "POST /api/email_invite, with valid parameters" do - setup [:valid_user] - - setup do - invites_enabled = Pleroma.Config.get([:instance, :invites_enabled]) - Pleroma.Config.put([:instance, :invites_enabled], true) - - on_exit(fn -> - Pleroma.Config.put([:instance, :invites_enabled], invites_enabled) - :ok - end) - - :ok - end - - test "it returns 204", %{conn: conn, user: user} do - recipient_email = "foo@bar.com" - recipient_name = "J. D." - - conn = - conn - |> assign(:user, user) - |> post("/api/email_invite?email=#{recipient_email}&name=#{recipient_name}") - - assert json_response(conn, :no_content) - - Swoosh.TestAssertions.assert_email_sent( - Pleroma.UserEmail.user_invitation_email(user, recipient_email, recipient_name) - ) - end - end - describe "GET /api/externalprofile/show" do test "it returns the user", %{conn: conn} do user = insert(:user)