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 @@ def follow(
%{
assigns: %{user: admin},
body_params: %{
"follower" => follower_nick,
"followed" => followed_nick
follower: follower_nick,
followed: followed_nick
}
} = conn,
_
@ -103,8 +103,8 @@ def unfollow(
%{
assigns: %{user: admin},
body_params: %{
"follower" => follower_nick,
"followed" => followed_nick
follower: follower_nick,
followed: followed_nick
}
} = conn,
_
@ -124,7 +124,7 @@ def unfollow(
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 @@ def toggle_activation(%{assigns: %{user: admin}} = conn, %{nickname: nickname})
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 @@ def activate(%{assigns: %{user: admin}, body_params: %{"nicknames" => nicknames}
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 @@ def deactivate(%{assigns: %{user: admin}, body_params: %{"nicknames" => nickname
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 @@ def approve(%{assigns: %{user: admin}, body_params: %{"nicknames" => nicknames}}
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 @@ def suggest(%{assigns: %{user: admin}, body_params: %{"nicknames" => nicknames}}
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 @@ def index_operation 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 @@ def create_operation do
description: "POST body for creating users",
type: :object,
properties: %{
"users" => %Schema{
users: %Schema{
type: :array,
items: %Schema{
type: :object,
@ -168,8 +168,8 @@ def follow_operation 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 @@ def unfollow_operation 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 @@ def approve_operation 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 @@ def suggest_operation 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 @@ def unsuggest_operation 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 @@ def activate_operation 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 @@ def deactivate_operation 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 @@ def delete_operation do
description: "POST body for deleting multiple users",
type: :object,
properties: %{
"nicknames" => %Schema{
nicknames: %Schema{
type: :array,
items: %Schema{type: :string}
}