[#114] Removed email_invite implementation (to be addressed separately).

This commit is contained in:
Ivan Tashkinov 2018-12-13 16:22:42 +03:00
parent 00744c6b03
commit 18b9467d1a
2 changed files with 1 additions and 39 deletions

View file

@ -335,13 +335,7 @@ defmodule Pleroma.Web.TwitterAPI.Controller do
def confirm_email(_conn, _params), do: :noop def confirm_email(_conn, _params), do: :noop
def email_invite(%{assigns: %{user: user}} = conn, %{"email" => email} = params) do def email_invite(_conn, _params), do: :noop
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 update_avatar(%{assigns: %{user: user}} = conn, params) do def update_avatar(%{assigns: %{user: user}} = conn, params) do
{:ok, object} = ActivityPub.upload(params, type: :avatar) {:ok, object} = ActivityPub.upload(params, type: :avatar)

View file

@ -873,38 +873,6 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do
end end
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 describe "GET /api/externalprofile/show" do
test "it returns the user", %{conn: conn} do test "it returns the user", %{conn: conn} do
user = insert(:user) user = insert(:user)