Merge branch 'develop' into 'improve_upgrade_user_from_ap_id'
[akkoma] / lib / pleroma / web / twitter_api / views / user_view.ex
index e8514d3ba2f69e3e7c9d960e979ec6403f9c224c..0791ed7608e1be3b3318d63a456f067d4d41ea02 100644 (file)
@@ -9,7 +9,6 @@ defmodule Pleroma.Web.TwitterAPI.UserView do
   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)
@@ -27,22 +26,6 @@ defmodule Pleroma.Web.TwitterAPI.UserView do
       else: %{}
   end
 
-  def render("index_for_admin.json", %{users: users, count: count, page_size: page_size} = opts) do
-    %{
-      users: render_many(users, UserView, "show_for_admin.json", opts),
-      count: count,
-      page_size: page_size
-    }
-  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,
@@ -135,7 +118,7 @@ defmodule Pleroma.Web.TwitterAPI.UserView do
           "confirmation_pending" => user_info.confirmation_pending,
           "tags" => user.tags
         }
-        |> maybe_with_follow_request_count(user, for_user)
+        |> maybe_with_activation_status(user, for_user)
     }
 
     data =
@@ -151,13 +134,11 @@ defmodule Pleroma.Web.TwitterAPI.UserView do
     end
   end
 
-  defp maybe_with_follow_request_count(data, %User{id: id, info: %{locked: true}} = user, %User{
-         id: id
-       }) do
-    Map.put(data, "follow_request_count", user.info.follow_request_count)
+  defp maybe_with_activation_status(data, user, %User{info: %{is_admin: true}}) do
+    Map.put(data, "deactivated", user.info.deactivated)
   end
 
-  defp maybe_with_follow_request_count(data, _, _), do: data
+  defp maybe_with_activation_status(data, _, _), do: data
 
   defp maybe_with_role(data, %User{id: id} = user, %User{id: id}) do
     Map.merge(data, %{"role" => role(user), "show_role" => user.info.show_role})