def delete_account(%{assigns: %{user: user}} = conn, params) do
case CommonAPI.Utils.confirm_current_password(user, params) do
{:ok, user} ->
- case User.delete(user) do
- :ok -> json(conn, %{status: "success"})
- :error -> json(conn, %{error: "Unable to delete user."})
- end
+ Task.start(fn -> User.delete(user) end)
+ json(conn, %{status: "success"})
{:error, msg} ->
json(conn, %{error: msg})
|> post("/api/pleroma/delete_account", %{"password" => "test"})
assert json_response(conn, 200) == %{"status" => "success"}
- fetched_user = Repo.get(User, current_user.id)
- assert fetched_user.info == %{"deactivated" => true}
end
end
end