X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fweb%2Ftwitter_api%2Fviews%2Fuser_view.ex;h=0791ed7608e1be3b3318d63a456f067d4d41ea02;hb=d0e94d5f1baac7a19d6cdd33b1f54470041e7227;hp=ad37baf3a68262efc85fd5653fd0ceb3dffe2ec0;hpb=035eaeb9b8702ed233e8bb589a78838efd1f131e;p=akkoma diff --git a/lib/pleroma/web/twitter_api/views/user_view.ex b/lib/pleroma/web/twitter_api/views/user_view.ex index ad37baf3a..0791ed760 100644 --- a/lib/pleroma/web/twitter_api/views/user_view.ex +++ b/lib/pleroma/web/twitter_api/views/user_view.ex @@ -4,11 +4,11 @@ defmodule Pleroma.Web.TwitterAPI.UserView do use Pleroma.Web, :view - alias Pleroma.User alias Pleroma.Formatter + alias Pleroma.HTML + alias Pleroma.User alias Pleroma.Web.CommonAPI.Utils alias Pleroma.Web.MediaProxy - alias Pleroma.HTML def render("show.json", %{user: user = %User{}} = assigns) do render_one(user, Pleroma.Web.TwitterAPI.UserView, "user.json", assigns) @@ -109,14 +109,16 @@ defmodule Pleroma.Web.TwitterAPI.UserView do "default_scope" => user.info.default_scope, "no_rich_text" => user.info.no_rich_text, "hide_followers" => user.info.hide_followers, - "hide_followings" => user.info.hide_followings, + "hide_follows" => user.info.hide_follows, "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 = @@ -132,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