alias Pleroma.User
alias Pleroma.Web.CommonAPI.Utils
alias Pleroma.Web.MediaProxy
+ alias Pleroma.Web.TwitterAPI.UserView
def render("show.json", %{user: user = %User{}} = assigns) do
render_one(user, Pleroma.Web.TwitterAPI.UserView, "user.json", assigns)
else: %{}
end
+ def render("index_for_admin.json", %{users: users} = opts) do
+ users
+ |> render_many(UserView, "show_for_admin.json", opts)
+ end
+
+ def render("show_for_admin.json", %{user: user}) do
+ %{
+ "id" => user.id,
+ "nickname" => user.nickname,
+ "deactivated" => user.info.deactivated
+ }
+ end
+
def render("short.json", %{
user: %User{
nickname: nickname,
"confirmation_pending" => user_info.confirmation_pending,
"tags" => user.tags
}
+ |> maybe_with_activation_status(user, for_user)
|> maybe_with_follow_request_count(user, for_user)
}
end
end
+ defp maybe_with_activation_status(data, user, %User{info: %{is_admin: true}}) do
+ Map.put(data, "deactivated", user.info.deactivated)
+ end
+
+ defp maybe_with_activation_status(data, _, _), do: data
+
defp maybe_with_follow_request_count(data, %User{id: id, info: %{locked: true}} = user, %User{
id: id
}) do