Revert "Pleroma.Web.AdminAPI.UserController: dialyzer errors"

This reverts commit d92c3d927d.
This commit is contained in:
Mark Felder 2024-01-30 14:14:39 -05:00
parent ac06a47689
commit 4227db0871
2 changed files with 24 additions and 24 deletions

View file

@ -53,11 +53,11 @@ defmodule Pleroma.Web.AdminAPI.UserController do
def delete(conn, %{nickname: nickname}) do
conn
|> Map.put(:body_params, %{"nicknames" => [nickname]})
|> Map.put(:body_params, %{nicknames: [nickname]})
|> delete(%{})
end
def delete(%{assigns: %{user: admin}, body_params: %{"nicknames" => nicknames}} = conn, _) do
def delete(%{assigns: %{user: admin}, body_params: %{nicknames: nicknames}} = conn, _) do
users = Enum.map(nicknames, &User.get_cached_by_nickname/1)
Enum.each(users, fn user ->
@ -78,8 +78,8 @@ defmodule Pleroma.Web.AdminAPI.UserController do
%{
assigns: %{user: admin},
body_params: %{
"follower" => follower_nick,
"followed" => followed_nick
follower: follower_nick,
followed: followed_nick
}
} = conn,
_
@ -103,8 +103,8 @@ defmodule Pleroma.Web.AdminAPI.UserController do
%{
assigns: %{user: admin},
body_params: %{
"follower" => follower_nick,
"followed" => followed_nick
follower: follower_nick,
followed: followed_nick
}
} = conn,
_
@ -124,7 +124,7 @@ defmodule Pleroma.Web.AdminAPI.UserController do
json(conn, "ok")
end
def create(%{assigns: %{user: admin}, body_params: %{"users" => users}} = conn, _) do
def create(%{assigns: %{user: admin}, body_params: %{users: users}} = conn, _) do
changesets =
users
|> Enum.map(fn %{nickname: nickname, email: email, password: password} ->
@ -202,7 +202,7 @@ defmodule Pleroma.Web.AdminAPI.UserController do
render(conn, "show.json", user: updated_user)
end
def activate(%{assigns: %{user: admin}, body_params: %{"nicknames" => nicknames}} = conn, _) do
def activate(%{assigns: %{user: admin}, body_params: %{nicknames: nicknames}} = conn, _) do
users = Enum.map(nicknames, &User.get_cached_by_nickname/1)
{:ok, updated_users} = User.set_activation(users, true)
@ -215,7 +215,7 @@ defmodule Pleroma.Web.AdminAPI.UserController do
render(conn, "index.json", users: updated_users)
end
def deactivate(%{assigns: %{user: admin}, body_params: %{"nicknames" => nicknames}} = conn, _) do
def deactivate(%{assigns: %{user: admin}, body_params: %{nicknames: nicknames}} = conn, _) do
users = Enum.map(nicknames, &User.get_cached_by_nickname/1)
{:ok, updated_users} = User.set_activation(users, false)
@ -228,7 +228,7 @@ defmodule Pleroma.Web.AdminAPI.UserController do
render(conn, "index.json", users: updated_users)
end
def approve(%{assigns: %{user: admin}, body_params: %{"nicknames" => nicknames}} = conn, _) do
def approve(%{assigns: %{user: admin}, body_params: %{nicknames: nicknames}} = conn, _) do
users = Enum.map(nicknames, &User.get_cached_by_nickname/1)
{:ok, updated_users} = User.approve(users)
@ -241,7 +241,7 @@ defmodule Pleroma.Web.AdminAPI.UserController do
render(conn, "index.json", users: updated_users)
end
def suggest(%{assigns: %{user: admin}, body_params: %{"nicknames" => nicknames}} = conn, _) do
def suggest(%{assigns: %{user: admin}, body_params: %{nicknames: nicknames}} = conn, _) do
users = Enum.map(nicknames, &User.get_cached_by_nickname/1)
{:ok, updated_users} = User.set_suggestion(users, true)
@ -254,7 +254,7 @@ defmodule Pleroma.Web.AdminAPI.UserController do
render(conn, "index.json", users: updated_users)
end
def unsuggest(%{assigns: %{user: admin}, body_params: %{"nicknames" => nicknames}} = conn, _) do
def unsuggest(%{assigns: %{user: admin}, body_params: %{nicknames: nicknames}} = conn, _) do
users = Enum.map(nicknames, &User.get_cached_by_nickname/1)
{:ok, updated_users} = User.set_suggestion(users, false)

View file

@ -50,7 +50,7 @@ defmodule Pleroma.Web.ApiSpec.Admin.UserOperation do
%Schema{
type: :object,
properties: %{
"users" => %Schema{type: :array, items: user()},
users: %Schema{type: :array, items: user()},
count: %Schema{type: :integer},
page_size: %Schema{type: :integer}
}
@ -75,7 +75,7 @@ defmodule Pleroma.Web.ApiSpec.Admin.UserOperation do
description: "POST body for creating users",
type: :object,
properties: %{
"users" => %Schema{
users: %Schema{
type: :array,
items: %Schema{
type: :object,
@ -168,8 +168,8 @@ defmodule Pleroma.Web.ApiSpec.Admin.UserOperation do
%Schema{
type: :object,
properties: %{
"follower" => %Schema{type: :string, description: "Follower nickname"},
"followed" => %Schema{type: :string, description: "Followed nickname"}
follower: %Schema{type: :string, description: "Follower nickname"},
followed: %Schema{type: :string, description: "Followed nickname"}
}
}
),
@ -193,8 +193,8 @@ defmodule Pleroma.Web.ApiSpec.Admin.UserOperation do
%Schema{
type: :object,
properties: %{
"follower" => %Schema{type: :string, description: "Follower nickname"},
"followed" => %Schema{type: :string, description: "Followed nickname"}
follower: %Schema{type: :string, description: "Follower nickname"},
followed: %Schema{type: :string, description: "Followed nickname"}
}
}
),
@ -219,7 +219,7 @@ defmodule Pleroma.Web.ApiSpec.Admin.UserOperation do
description: "POST body for approving multiple users",
type: :object,
properties: %{
"nicknames" => %Schema{
nicknames: %Schema{
type: :array,
items: %Schema{type: :string}
}
@ -251,7 +251,7 @@ defmodule Pleroma.Web.ApiSpec.Admin.UserOperation do
description: "POST body for adding multiple suggested users",
type: :object,
properties: %{
"nicknames" => %Schema{
nicknames: %Schema{
type: :array,
items: %Schema{type: :string}
}
@ -283,7 +283,7 @@ defmodule Pleroma.Web.ApiSpec.Admin.UserOperation do
description: "POST body for removing multiple suggested users",
type: :object,
properties: %{
"nicknames" => %Schema{
nicknames: %Schema{
type: :array,
items: %Schema{type: :string}
}
@ -332,7 +332,7 @@ defmodule Pleroma.Web.ApiSpec.Admin.UserOperation do
description: "POST body for deleting multiple users",
type: :object,
properties: %{
"nicknames" => %Schema{
nicknames: %Schema{
type: :array,
items: %Schema{type: :string}
}
@ -364,7 +364,7 @@ defmodule Pleroma.Web.ApiSpec.Admin.UserOperation do
description: "POST body for deleting multiple users",
type: :object,
properties: %{
"nicknames" => %Schema{
nicknames: %Schema{
type: :array,
items: %Schema{type: :string}
}
@ -404,7 +404,7 @@ defmodule Pleroma.Web.ApiSpec.Admin.UserOperation do
description: "POST body for deleting multiple users",
type: :object,
properties: %{
"nicknames" => %Schema{
nicknames: %Schema{
type: :array,
items: %Schema{type: :string}
}