From ab83e0de6d389428cec11fe94280d675a38f00d0 Mon Sep 17 00:00:00 2001 From: eal Date: Thu, 1 Feb 2018 21:41:19 +0200 Subject: [PATCH] TwitterAPI: Add is_local to user view. --- lib/pleroma/web/twitter_api/views/user_view.ex | 1 + test/web/twitter_api/views/user_view_test.exs | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/pleroma/web/twitter_api/views/user_view.ex b/lib/pleroma/web/twitter_api/views/user_view.ex index 1b995f42f..f49bcc0fb 100644 --- a/lib/pleroma/web/twitter_api/views/user_view.ex +++ b/lib/pleroma/web/twitter_api/views/user_view.ex @@ -47,6 +47,7 @@ def render("user.json", %{user: user = %User{}} = assigns) do "statusnet_profile_url" => user.ap_id, "cover_photo" => User.banner_url(user) |> MediaProxy.url(), "background_image" => image_url(user.info["background"]) |> MediaProxy.url(), + "is_local" => user.local } if assigns[:token] do diff --git a/test/web/twitter_api/views/user_view_test.exs b/test/web/twitter_api/views/user_view_test.exs index 3f84e4116..e68230a86 100644 --- a/test/web/twitter_api/views/user_view_test.exs +++ b/test/web/twitter_api/views/user_view_test.exs @@ -56,7 +56,8 @@ test "A user" do "rights" => %{}, "statusnet_profile_url" => user.ap_id, "cover_photo" => banner, - "background_image" => nil + "background_image" => nil, + "is_local" => true } assert represented == UserView.render("show.json", %{user: user}) @@ -88,7 +89,8 @@ test "A user for a given other follower", %{user: user} do "rights" => %{}, "statusnet_profile_url" => user.ap_id, "cover_photo" => banner, - "background_image" => nil + "background_image" => nil, + "is_local" => true } assert represented == UserView.render("show.json", %{user: user, for: follower}) @@ -121,7 +123,8 @@ test "A user that follows you", %{user: user} do "rights" => %{}, "statusnet_profile_url" => follower.ap_id, "cover_photo" => banner, - "background_image" => nil + "background_image" => nil, + "is_local" => true } assert represented == UserView.render("show.json", %{user: follower, for: user}) @@ -154,7 +157,8 @@ test "A blocked user for the blocker", %{user: user} do "rights" => %{}, "statusnet_profile_url" => user.ap_id, "cover_photo" => banner, - "background_image" => nil + "background_image" => nil, + "is_local" => true } blocker = Repo.get(User, blocker.id)