From 398c81f9c8e55b280e64948b4ac63ae51fabd32f Mon Sep 17 00:00:00 2001 From: eugenijm Date: Mon, 4 Feb 2019 05:03:57 +0300 Subject: [PATCH] Add is_admin and is_moderator boolean fields to the user view --- lib/pleroma/web/twitter_api/views/user_view.ex | 2 ++ test/web/twitter_api/views/user_view_test.exs | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/lib/pleroma/web/twitter_api/views/user_view.ex b/lib/pleroma/web/twitter_api/views/user_view.ex index cd7c4349c..2a0cc5c0f 100644 --- a/lib/pleroma/web/twitter_api/views/user_view.ex +++ b/lib/pleroma/web/twitter_api/views/user_view.ex @@ -105,6 +105,8 @@ defp do_render("user.json", %{user: user = %User{}} = assigns) do "cover_photo" => User.banner_url(user) |> MediaProxy.url(), "background_image" => image_url(user.info.background) |> MediaProxy.url(), "is_local" => user.local, + "is_moderator" => user.info.is_moderator, + "is_admin" => user.info.is_admin, "locked" => user.info.locked, "default_scope" => user.info.default_scope, "no_rich_text" => user.info.no_rich_text, diff --git a/test/web/twitter_api/views/user_view_test.exs b/test/web/twitter_api/views/user_view_test.exs index 0885afaec..637b84d72 100644 --- a/test/web/twitter_api/views/user_view_test.exs +++ b/test/web/twitter_api/views/user_view_test.exs @@ -97,6 +97,8 @@ test "A user" do "cover_photo" => banner, "background_image" => nil, "is_local" => true, + "is_admin" => false, + "is_moderator" => false, "locked" => false, "default_scope" => "public", "no_rich_text" => false, @@ -145,6 +147,8 @@ test "A user for a given other follower", %{user: user} do "cover_photo" => banner, "background_image" => nil, "is_local" => true, + "is_admin" => false, + "is_moderator" => false, "locked" => false, "default_scope" => "public", "no_rich_text" => false, @@ -194,6 +198,8 @@ test "A user that follows you", %{user: user} do "cover_photo" => banner, "background_image" => nil, "is_local" => true, + "is_admin" => false, + "is_moderator" => false, "locked" => false, "default_scope" => "public", "no_rich_text" => false, @@ -257,6 +263,8 @@ test "A blocked user for the blocker" do "cover_photo" => banner, "background_image" => nil, "is_local" => true, + "is_admin" => false, + "is_moderator" => false, "locked" => false, "default_scope" => "public", "no_rich_text" => false,