Merge remote-tracking branch 'upstream/develop' into feature/openldap-support
[akkoma] / lib / pleroma / web / admin_api / views / account_view.ex
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.Web.AdminAPI.AccountView do
6 use Pleroma.Web, :view
7
8 alias Pleroma.User.Info
9 alias Pleroma.Web.AdminAPI.AccountView
10
11 def render("index.json", %{users: users, count: count, page_size: page_size}) do
12 %{
13 users: render_many(users, AccountView, "show.json", as: :user),
14 count: count,
15 page_size: page_size
16 }
17 end
18
19 def render("show.json", %{user: user}) do
20 %{
21 "id" => user.id,
22 "nickname" => user.nickname,
23 "deactivated" => user.info.deactivated,
24 "local" => user.local,
25 "roles" => Info.roles(user.info),
26 "tags" => user.tags || []
27 }
28 end
29 end