mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-23 15:05:45 +00:00
Modified deleting an account to run as a task
This commit is contained in:
parent
98b36d359a
commit
d1366f8d46
|
@ -200,10 +200,8 @@ defmodule Pleroma.Web.TwitterAPI.UtilController do
|
||||||
def delete_account(%{assigns: %{user: user}} = conn, params) do
|
def delete_account(%{assigns: %{user: user}} = conn, params) do
|
||||||
case CommonAPI.Utils.confirm_current_password(user, params) do
|
case CommonAPI.Utils.confirm_current_password(user, params) do
|
||||||
{:ok, user} ->
|
{:ok, user} ->
|
||||||
case User.delete(user) do
|
Task.start(fn -> User.delete(user) end)
|
||||||
:ok -> json(conn, %{status: "success"})
|
json(conn, %{status: "success"})
|
||||||
:error -> json(conn, %{error: "Unable to delete user."})
|
|
||||||
end
|
|
||||||
|
|
||||||
{:error, msg} ->
|
{:error, msg} ->
|
||||||
json(conn, %{error: msg})
|
json(conn, %{error: msg})
|
||||||
|
|
|
@ -825,8 +825,6 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do
|
||||||
|> post("/api/pleroma/delete_account", %{"password" => "test"})
|
|> post("/api/pleroma/delete_account", %{"password" => "test"})
|
||||||
|
|
||||||
assert json_response(conn, 200) == %{"status" => "success"}
|
assert json_response(conn, 200) == %{"status" => "success"}
|
||||||
fetched_user = Repo.get(User, current_user.id)
|
|
||||||
assert fetched_user.info == %{"deactivated" => true}
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue