Fix count
This commit is contained in:
parent
6f9d3d30fa
commit
ced9f92327
1 changed files with 10 additions and 5 deletions
|
@ -333,8 +333,8 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIController do
|
||||||
email: params["email"]
|
email: params["email"]
|
||||||
}
|
}
|
||||||
|
|
||||||
with {:ok, users, _count} <- Search.user(Map.merge(search_params, filters)),
|
with {:ok, users, count} <- Search.user(Map.merge(search_params, filters)),
|
||||||
{:ok, users, count} <- filter_relay_user(users),
|
{:ok, users, count} <- filter_relay_user(users, count),
|
||||||
do:
|
do:
|
||||||
conn
|
conn
|
||||||
|> json(
|
|> json(
|
||||||
|
@ -346,10 +346,15 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIController do
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
defp filter_relay_user(users) do
|
defp filter_relay_user(users, count) do
|
||||||
filtered_users = Enum.reject(users, &(&1.ap_id == Relay.relay_ap_id()))
|
filtered_users = Enum.reject(users, &relay_user?/1)
|
||||||
|
count = if Enum.any?(users, &relay_user?/1), do: length(filtered_users), else: count
|
||||||
|
|
||||||
{:ok, filtered_users, length(filtered_users)}
|
{:ok, filtered_users, count}
|
||||||
|
end
|
||||||
|
|
||||||
|
defp relay_user?(user) do
|
||||||
|
user.ap_id == Relay.relay_ap_id()
|
||||||
end
|
end
|
||||||
|
|
||||||
@filters ~w(local external active deactivated is_admin is_moderator)
|
@filters ~w(local external active deactivated is_admin is_moderator)
|
||||||
|
|
Loading…
Reference in a new issue