Modified deleting an account to run as a task
authorSyldexia <syldexia@ofthewi.red>
Sat, 19 May 2018 12:35:49 +0000 (13:35 +0100)
committerSyldexia <syldexia@ofthewi.red>
Sat, 19 May 2018 12:35:49 +0000 (13:35 +0100)
lib/pleroma/web/twitter_api/controllers/util_controller.ex
test/web/twitter_api/twitter_api_controller_test.exs

index 3f3ddb9e4f12a2514ebd72e7a93eeaf67c34686c..23e7408a0f8e7b454d0e94095701fc58cb1c9a7a 100644 (file)
@@ -200,10 +200,8 @@ defmodule Pleroma.Web.TwitterAPI.UtilController do
   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})
index 170dda145e6f83502f147305433558036daad98d..02aba0bc8859ba105ce73d919275667f6b69955a 100644 (file)
@@ -825,8 +825,6 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do
         |> 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