mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-12-23 00:26:30 +00:00
Revert "Pleroma.Web.AdminAPI.UserController: dialyzer errors"
This reverts commit d92c3d927d
.
This commit is contained in:
parent
ac06a47689
commit
4227db0871
2 changed files with 24 additions and 24 deletions
|
@ -53,11 +53,11 @@ defmodule Pleroma.Web.AdminAPI.UserController do
|
||||||
|
|
||||||
def delete(conn, %{nickname: nickname}) do
|
def delete(conn, %{nickname: nickname}) do
|
||||||
conn
|
conn
|
||||||
|> Map.put(:body_params, %{"nicknames" => [nickname]})
|
|> Map.put(:body_params, %{nicknames: [nickname]})
|
||||||
|> delete(%{})
|
|> delete(%{})
|
||||||
end
|
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)
|
users = Enum.map(nicknames, &User.get_cached_by_nickname/1)
|
||||||
|
|
||||||
Enum.each(users, fn user ->
|
Enum.each(users, fn user ->
|
||||||
|
@ -78,8 +78,8 @@ defmodule Pleroma.Web.AdminAPI.UserController do
|
||||||
%{
|
%{
|
||||||
assigns: %{user: admin},
|
assigns: %{user: admin},
|
||||||
body_params: %{
|
body_params: %{
|
||||||
"follower" => follower_nick,
|
follower: follower_nick,
|
||||||
"followed" => followed_nick
|
followed: followed_nick
|
||||||
}
|
}
|
||||||
} = conn,
|
} = conn,
|
||||||
_
|
_
|
||||||
|
@ -103,8 +103,8 @@ defmodule Pleroma.Web.AdminAPI.UserController do
|
||||||
%{
|
%{
|
||||||
assigns: %{user: admin},
|
assigns: %{user: admin},
|
||||||
body_params: %{
|
body_params: %{
|
||||||
"follower" => follower_nick,
|
follower: follower_nick,
|
||||||
"followed" => followed_nick
|
followed: followed_nick
|
||||||
}
|
}
|
||||||
} = conn,
|
} = conn,
|
||||||
_
|
_
|
||||||
|
@ -124,7 +124,7 @@ defmodule Pleroma.Web.AdminAPI.UserController do
|
||||||
json(conn, "ok")
|
json(conn, "ok")
|
||||||
end
|
end
|
||||||
|
|
||||||
def create(%{assigns: %{user: admin}, body_params: %{"users" => users}} = conn, _) do
|
def create(%{assigns: %{user: admin}, body_params: %{users: users}} = conn, _) do
|
||||||
changesets =
|
changesets =
|
||||||
users
|
users
|
||||||
|> Enum.map(fn %{nickname: nickname, email: email, password: password} ->
|
|> 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)
|
render(conn, "show.json", user: updated_user)
|
||||||
end
|
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)
|
users = Enum.map(nicknames, &User.get_cached_by_nickname/1)
|
||||||
{:ok, updated_users} = User.set_activation(users, true)
|
{: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)
|
render(conn, "index.json", users: updated_users)
|
||||||
end
|
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)
|
users = Enum.map(nicknames, &User.get_cached_by_nickname/1)
|
||||||
{:ok, updated_users} = User.set_activation(users, false)
|
{: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)
|
render(conn, "index.json", users: updated_users)
|
||||||
end
|
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)
|
users = Enum.map(nicknames, &User.get_cached_by_nickname/1)
|
||||||
{:ok, updated_users} = User.approve(users)
|
{:ok, updated_users} = User.approve(users)
|
||||||
|
|
||||||
|
@ -241,7 +241,7 @@ defmodule Pleroma.Web.AdminAPI.UserController do
|
||||||
render(conn, "index.json", users: updated_users)
|
render(conn, "index.json", users: updated_users)
|
||||||
end
|
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)
|
users = Enum.map(nicknames, &User.get_cached_by_nickname/1)
|
||||||
{:ok, updated_users} = User.set_suggestion(users, true)
|
{: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)
|
render(conn, "index.json", users: updated_users)
|
||||||
end
|
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)
|
users = Enum.map(nicknames, &User.get_cached_by_nickname/1)
|
||||||
{:ok, updated_users} = User.set_suggestion(users, false)
|
{:ok, updated_users} = User.set_suggestion(users, false)
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ defmodule Pleroma.Web.ApiSpec.Admin.UserOperation do
|
||||||
%Schema{
|
%Schema{
|
||||||
type: :object,
|
type: :object,
|
||||||
properties: %{
|
properties: %{
|
||||||
"users" => %Schema{type: :array, items: user()},
|
users: %Schema{type: :array, items: user()},
|
||||||
count: %Schema{type: :integer},
|
count: %Schema{type: :integer},
|
||||||
page_size: %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",
|
description: "POST body for creating users",
|
||||||
type: :object,
|
type: :object,
|
||||||
properties: %{
|
properties: %{
|
||||||
"users" => %Schema{
|
users: %Schema{
|
||||||
type: :array,
|
type: :array,
|
||||||
items: %Schema{
|
items: %Schema{
|
||||||
type: :object,
|
type: :object,
|
||||||
|
@ -168,8 +168,8 @@ defmodule Pleroma.Web.ApiSpec.Admin.UserOperation do
|
||||||
%Schema{
|
%Schema{
|
||||||
type: :object,
|
type: :object,
|
||||||
properties: %{
|
properties: %{
|
||||||
"follower" => %Schema{type: :string, description: "Follower nickname"},
|
follower: %Schema{type: :string, description: "Follower nickname"},
|
||||||
"followed" => %Schema{type: :string, description: "Followed nickname"}
|
followed: %Schema{type: :string, description: "Followed nickname"}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
|
@ -193,8 +193,8 @@ defmodule Pleroma.Web.ApiSpec.Admin.UserOperation do
|
||||||
%Schema{
|
%Schema{
|
||||||
type: :object,
|
type: :object,
|
||||||
properties: %{
|
properties: %{
|
||||||
"follower" => %Schema{type: :string, description: "Follower nickname"},
|
follower: %Schema{type: :string, description: "Follower nickname"},
|
||||||
"followed" => %Schema{type: :string, description: "Followed 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",
|
description: "POST body for approving multiple users",
|
||||||
type: :object,
|
type: :object,
|
||||||
properties: %{
|
properties: %{
|
||||||
"nicknames" => %Schema{
|
nicknames: %Schema{
|
||||||
type: :array,
|
type: :array,
|
||||||
items: %Schema{type: :string}
|
items: %Schema{type: :string}
|
||||||
}
|
}
|
||||||
|
@ -251,7 +251,7 @@ defmodule Pleroma.Web.ApiSpec.Admin.UserOperation do
|
||||||
description: "POST body for adding multiple suggested users",
|
description: "POST body for adding multiple suggested users",
|
||||||
type: :object,
|
type: :object,
|
||||||
properties: %{
|
properties: %{
|
||||||
"nicknames" => %Schema{
|
nicknames: %Schema{
|
||||||
type: :array,
|
type: :array,
|
||||||
items: %Schema{type: :string}
|
items: %Schema{type: :string}
|
||||||
}
|
}
|
||||||
|
@ -283,7 +283,7 @@ defmodule Pleroma.Web.ApiSpec.Admin.UserOperation do
|
||||||
description: "POST body for removing multiple suggested users",
|
description: "POST body for removing multiple suggested users",
|
||||||
type: :object,
|
type: :object,
|
||||||
properties: %{
|
properties: %{
|
||||||
"nicknames" => %Schema{
|
nicknames: %Schema{
|
||||||
type: :array,
|
type: :array,
|
||||||
items: %Schema{type: :string}
|
items: %Schema{type: :string}
|
||||||
}
|
}
|
||||||
|
@ -332,7 +332,7 @@ defmodule Pleroma.Web.ApiSpec.Admin.UserOperation do
|
||||||
description: "POST body for deleting multiple users",
|
description: "POST body for deleting multiple users",
|
||||||
type: :object,
|
type: :object,
|
||||||
properties: %{
|
properties: %{
|
||||||
"nicknames" => %Schema{
|
nicknames: %Schema{
|
||||||
type: :array,
|
type: :array,
|
||||||
items: %Schema{type: :string}
|
items: %Schema{type: :string}
|
||||||
}
|
}
|
||||||
|
@ -364,7 +364,7 @@ defmodule Pleroma.Web.ApiSpec.Admin.UserOperation do
|
||||||
description: "POST body for deleting multiple users",
|
description: "POST body for deleting multiple users",
|
||||||
type: :object,
|
type: :object,
|
||||||
properties: %{
|
properties: %{
|
||||||
"nicknames" => %Schema{
|
nicknames: %Schema{
|
||||||
type: :array,
|
type: :array,
|
||||||
items: %Schema{type: :string}
|
items: %Schema{type: :string}
|
||||||
}
|
}
|
||||||
|
@ -404,7 +404,7 @@ defmodule Pleroma.Web.ApiSpec.Admin.UserOperation do
|
||||||
description: "POST body for deleting multiple users",
|
description: "POST body for deleting multiple users",
|
||||||
type: :object,
|
type: :object,
|
||||||
properties: %{
|
properties: %{
|
||||||
"nicknames" => %Schema{
|
nicknames: %Schema{
|
||||||
type: :array,
|
type: :array,
|
||||||
items: %Schema{type: :string}
|
items: %Schema{type: :string}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue