Merge branch 'features/bio_rel_me' into 'develop'
[akkoma] / lib / pleroma / web / twitter_api / views / user_view.ex
index 3cde3bc1beeeea757fd3dc476ec8e23b4b1fd39d..0791ed7608e1be3b3318d63a456f067d4d41ea02 100644 (file)
@@ -4,7 +4,9 @@
 
 defmodule Pleroma.Web.TwitterAPI.UserView do
   use Pleroma.Web, :view
-  alias Pleroma.{Formatter, HTML, User}
+  alias Pleroma.Formatter
+  alias Pleroma.HTML
+  alias Pleroma.User
   alias Pleroma.Web.CommonAPI.Utils
   alias Pleroma.Web.MediaProxy
 
@@ -111,10 +113,12 @@ defmodule Pleroma.Web.TwitterAPI.UserView do
       "fields" => fields,
 
       # Pleroma extension
-      "pleroma" => %{
-        "confirmation_pending" => user_info.confirmation_pending,
-        "tags" => user.tags
-      }
+      "pleroma" =>
+        %{
+          "confirmation_pending" => user_info.confirmation_pending,
+          "tags" => user.tags
+        }
+        |> maybe_with_activation_status(user, for_user)
     }
 
     data =
@@ -130,6 +134,12 @@ defmodule Pleroma.Web.TwitterAPI.UserView do
     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_role(data, %User{id: id} = user, %User{id: id}) do
     Map.merge(data, %{"role" => role(user), "show_role" => user.info.show_role})
   end