1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Web.AdminAPI.AccountView do
10 alias Pleroma.User.Info
11 alias Pleroma.Web.AdminAPI.AccountView
12 alias Pleroma.Web.MediaProxy
14 def render("index.json", %{users: users, count: count, page_size: page_size}) do
16 users: render_many(users, AccountView, "show.json", as: :user),
22 def render("show.json", %{user: user}) do
23 avatar = User.avatar_url(user) |> MediaProxy.url()
24 display_name = HTML.strip_tags(user.name || user.nickname)
29 "nickname" => user.nickname,
30 "display_name" => display_name,
31 "deactivated" => user.info.deactivated,
32 "local" => user.local,
33 "roles" => Info.roles(user.info),
34 "tags" => user.tags || []
38 def render("invite.json", %{invite: invite}) do
41 "token" => invite.token,
42 "used" => invite.used,
43 "expires_at" => invite.expires_at,
44 "uses" => invite.uses,
45 "max_use" => invite.max_use,
46 "invite_type" => invite.invite_type
50 def render("invites.json", %{invites: invites}) do
52 invites: render_many(invites, AccountView, "invite.json", as: :invite)