Deleting a user from AdminAPI should use User.delete/1

This commit is contained in:
Mark Felder 2021-02-23 09:49:27 -06:00
parent d113ed94e7
commit cc0756ec56

View File

@ -10,8 +10,6 @@ defmodule Pleroma.Web.AdminAPI.UserController do
alias Pleroma.ModerationLog alias Pleroma.ModerationLog
alias Pleroma.User alias Pleroma.User
alias Pleroma.Web.ActivityPub.Builder
alias Pleroma.Web.ActivityPub.Pipeline
alias Pleroma.Web.AdminAPI alias Pleroma.Web.AdminAPI
alias Pleroma.Web.AdminAPI.AccountView alias Pleroma.Web.AdminAPI.AccountView
alias Pleroma.Web.AdminAPI.Search alias Pleroma.Web.AdminAPI.Search
@ -53,10 +51,7 @@ defmodule Pleroma.Web.AdminAPI.UserController do
def delete(%{assigns: %{user: admin}} = conn, %{"nicknames" => nicknames}) do def delete(%{assigns: %{user: admin}} = conn, %{"nicknames" => nicknames}) do
users = Enum.map(nicknames, &User.get_cached_by_nickname/1) users = Enum.map(nicknames, &User.get_cached_by_nickname/1)
Enum.each(users, fn user -> Enum.each(users, &User.delete(&1))
{:ok, delete_data, _} = Builder.delete(admin, user.ap_id)
Pipeline.common_pipeline(delete_data, local: true)
end)
ModerationLog.insert_log(%{ ModerationLog.insert_log(%{
actor: admin, actor: admin,