akkoma/lib/pleroma/web/mastodon_api/views/admin/account_view.ex

28 lines
747 B
Elixir
Raw Normal View History

2019-02-28 14:43:09 +00:00
# Pleroma: A lightweight social networking server
# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.MastodonAPI.Admin.AccountView do
use Pleroma.Web, :view
alias Pleroma.Web.MastodonAPI.Admin.AccountView
2019-03-12 19:15:28 +00:00
alias Pleroma.User.Info
2019-02-28 14:43:09 +00: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 19:15:28 +00:00
"deactivated" => user.info.deactivated,
"roles" => Info.roles(user.info)
2019-02-28 14:43:09 +00:00
}
end
end