summaryrefslogtreecommitdiff
path: root/lib/pleroma/web/admin_api/views/account_view.ex
diff options
context:
space:
mode:
Diffstat (limited to 'lib/pleroma/web/admin_api/views/account_view.ex')
-rw-r--r--lib/pleroma/web/admin_api/views/account_view.ex33
1 files changed, 14 insertions, 19 deletions
diff --git a/lib/pleroma/web/admin_api/views/account_view.ex b/lib/pleroma/web/admin_api/views/account_view.ex
index a16a3ebf0..9c477feab 100644
--- a/lib/pleroma/web/admin_api/views/account_view.ex
+++ b/lib/pleroma/web/admin_api/views/account_view.ex
@@ -6,7 +6,9 @@ defmodule Pleroma.Web.AdminAPI.AccountView do
use Pleroma.Web, :view
alias Pleroma.User
+ alias Pleroma.Web.AdminAPI
alias Pleroma.Web.AdminAPI.AccountView
+ alias Pleroma.Web.MastodonAPI
alias Pleroma.Web.MediaProxy
def render("index.json", %{users: users, count: count, page_size: page_size}) do
@@ -74,25 +76,11 @@ defmodule Pleroma.Web.AdminAPI.AccountView do
"local" => user.local,
"roles" => User.roles(user),
"tags" => user.tags || [],
- "confirmation_pending" => user.confirmation_pending
- }
- end
-
- def render("invite.json", %{invite: invite}) do
- %{
- "id" => invite.id,
- "token" => invite.token,
- "used" => invite.used,
- "expires_at" => invite.expires_at,
- "uses" => invite.uses,
- "max_use" => invite.max_use,
- "invite_type" => invite.invite_type
- }
- end
-
- def render("invites.json", %{invites: invites}) do
- %{
- invites: render_many(invites, AccountView, "invite.json", as: :invite)
+ "confirmation_pending" => user.confirmation_pending,
+ "approval_pending" => user.approval_pending,
+ "url" => user.uri || user.ap_id,
+ "registration_reason" => user.registration_reason,
+ "actor_type" => user.actor_type
}
end
@@ -119,6 +107,13 @@ defmodule Pleroma.Web.AdminAPI.AccountView do
}
end
+ def merge_account_views(%User{} = user) do
+ MastodonAPI.AccountView.render("show.json", %{user: user, skip_visibility_check: true})
+ |> Map.merge(AdminAPI.AccountView.render("show.json", %{user: user}))
+ end
+
+ def merge_account_views(_), do: %{}
+
defp parse_error([]), do: ""
defp parse_error(errors) do