2019-02-28 15:43:09 +01:00
|
|
|
# Pleroma: A lightweight social networking server
|
|
|
|
# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
|
|
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2019-03-13 04:13:28 +01:00
|
|
|
defmodule Pleroma.Web.AdminAPI.AccountView do
|
2019-02-28 15:43:09 +01:00
|
|
|
use Pleroma.Web, :view
|
|
|
|
|
2019-03-12 20:15:28 +01:00
|
|
|
alias Pleroma.User.Info
|
2019-03-13 04:13:28 +01:00
|
|
|
alias Pleroma.Web.AdminAPI.AccountView
|
2019-02-28 15:43:09 +01:00
|
|
|
|
|
|
|
def render("index.json", %{users: users, count: count, page_size: page_size}) do
|
|
|
|
%{
|
|
|
|
users: render_many(users, AccountView, "show.json", as: :user),
|
|
|
|
count: count,
|
|
|
|
page_size: page_size
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
def render("show.json", %{user: user}) do
|
|
|
|
%{
|
|
|
|
"id" => user.id,
|
|
|
|
"nickname" => user.nickname,
|
2019-03-12 20:15:28 +01:00
|
|
|
"deactivated" => user.info.deactivated,
|
2019-03-13 14:04:44 +01:00
|
|
|
"local" => user.local,
|
2019-03-13 23:52:24 +01:00
|
|
|
"roles" => Info.roles(user.info),
|
2019-03-14 01:17:09 +01:00
|
|
|
"tags" => user.tags || []
|
2019-02-28 15:43:09 +01:00
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|