From 490d9cf7b149bbb93f6065fc807eafd339bcc0ea Mon Sep 17 00:00:00 2001 From: Maxim Filippov Date: Wed, 13 Mar 2019 16:04:44 +0300 Subject: [PATCH] Add "local" to users admin API --- .../mastodon_api/views/admin/account_view.ex | 1 + .../admin_api/admin_api_controller_test.exs | 21 ++++++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/lib/pleroma/web/mastodon_api/views/admin/account_view.ex b/lib/pleroma/web/mastodon_api/views/admin/account_view.ex index 5ce017124..1bed11089 100644 --- a/lib/pleroma/web/mastodon_api/views/admin/account_view.ex +++ b/lib/pleroma/web/mastodon_api/views/admin/account_view.ex @@ -21,6 +21,7 @@ def render("show.json", %{user: user}) do "id" => user.id, "nickname" => user.nickname, "deactivated" => user.info.deactivated, + "local" => user.local, "roles" => Info.roles(user.info) } end diff --git a/test/web/admin_api/admin_api_controller_test.exs b/test/web/admin_api/admin_api_controller_test.exs index 0470a439b..c72e6b975 100644 --- a/test/web/admin_api/admin_api_controller_test.exs +++ b/test/web/admin_api/admin_api_controller_test.exs @@ -394,7 +394,8 @@ test "regular search" do "deactivated" => user.info.deactivated, "id" => user.id, "nickname" => user.nickname, - "roles" => %{"admin" => false, "moderator" => false} + "roles" => %{"admin" => false, "moderator" => false}, + "local" => true } ] } @@ -418,7 +419,8 @@ test "regular search with page size" do "deactivated" => user.info.deactivated, "id" => user.id, "nickname" => user.nickname, - "roles" => %{"admin" => false, "moderator" => false} + "roles" => %{"admin" => false, "moderator" => false}, + "local" => true } ] } @@ -436,7 +438,8 @@ test "regular search with page size" do "deactivated" => user2.info.deactivated, "id" => user2.id, "nickname" => user2.nickname, - "roles" => %{"admin" => false, "moderator" => false} + "roles" => %{"admin" => false, "moderator" => false}, + "local" => true } ] } @@ -461,7 +464,8 @@ test "only local users" do "deactivated" => user.info.deactivated, "id" => user.id, "nickname" => user.nickname, - "roles" => %{"admin" => false, "moderator" => false} + "roles" => %{"admin" => false, "moderator" => false}, + "local" => true } ] } @@ -486,13 +490,15 @@ test "only local users with no query" do "deactivated" => admin.info.deactivated, "id" => admin.id, "nickname" => admin.nickname, - "roles" => %{"admin" => true, "moderator" => false} + "roles" => %{"admin" => true, "moderator" => false}, + "local" => true }, %{ "deactivated" => user.info.deactivated, "id" => user.id, "nickname" => user.nickname, - "roles" => %{"admin" => false, "moderator" => false} + "roles" => %{"admin" => false, "moderator" => false}, + "local" => true } ] } @@ -513,7 +519,8 @@ test "PATCH /api/pleroma/admin/users/:nickname/toggle_activation" do "deactivated" => !user.info.deactivated, "id" => user.id, "nickname" => user.nickname, - "roles" => %{"admin" => false, "moderator" => false} + "roles" => %{"admin" => false, "moderator" => false}, + "local" => true } end end