commit: 4227db08716bf46d677009127438746bd7cd6729
parent ac06a476896831ce74e87cd5d3b889d34426ad73
Author: Mark Felder <feld@feld.me>
Date: Tue, 30 Jan 2024 14:14:39 -0500
Revert "Pleroma.Web.AdminAPI.UserController: dialyzer errors"
This reverts commit d92c3d927d4134941dabef3e8f1b5209de115665.
Diffstat:
2 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/lib/pleroma/web/admin_api/controllers/user_controller.ex b/lib/pleroma/web/admin_api/controllers/user_controller.ex
@@ -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)
diff --git a/lib/pleroma/web/api_spec/operations/admin/user_operation.ex b/lib/pleroma/web/api_spec/operations/admin/user_operation.ex
@@ -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}
}