Merge branch 'feature/add-local-to-users-admin-api' into 'develop'

Add "local" & "tags" to users admin API

See merge request pleroma/pleroma!932
This commit is contained in:
kaniini 2019-03-14 02:00:47 +00:00
commit 86871c8a04
2 changed files with 31 additions and 11 deletions

View file

@ -21,7 +21,9 @@ defmodule Pleroma.Web.MastodonAPI.Admin.AccountView do
"id" => user.id, "id" => user.id,
"nickname" => user.nickname, "nickname" => user.nickname,
"deactivated" => user.info.deactivated, "deactivated" => user.info.deactivated,
"roles" => Info.roles(user.info) "local" => user.local,
"roles" => Info.roles(user.info),
"tags" => user.tags || []
} }
end end
end end

View file

@ -334,7 +334,7 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do
describe "GET /api/pleroma/admin/users" do describe "GET /api/pleroma/admin/users" do
test "renders users array for the first page" do test "renders users array for the first page" do
admin = insert(:user, info: %{is_admin: true}) admin = insert(:user, info: %{is_admin: true})
user = insert(:user) user = insert(:user, local: false, tags: ["foo", "bar"])
conn = conn =
build_conn() build_conn()
@ -349,13 +349,17 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do
"deactivated" => admin.info.deactivated, "deactivated" => admin.info.deactivated,
"id" => admin.id, "id" => admin.id,
"nickname" => admin.nickname, "nickname" => admin.nickname,
"roles" => %{"admin" => true, "moderator" => false} "roles" => %{"admin" => true, "moderator" => false},
"local" => true,
"tags" => []
}, },
%{ %{
"deactivated" => user.info.deactivated, "deactivated" => user.info.deactivated,
"id" => user.id, "id" => user.id,
"nickname" => user.nickname, "nickname" => user.nickname,
"roles" => %{"admin" => false, "moderator" => false} "roles" => %{"admin" => false, "moderator" => false},
"local" => false,
"tags" => ["foo", "bar"]
} }
] ]
} }
@ -394,7 +398,9 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do
"deactivated" => user.info.deactivated, "deactivated" => user.info.deactivated,
"id" => user.id, "id" => user.id,
"nickname" => user.nickname, "nickname" => user.nickname,
"roles" => %{"admin" => false, "moderator" => false} "roles" => %{"admin" => false, "moderator" => false},
"local" => true,
"tags" => []
} }
] ]
} }
@ -418,7 +424,9 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do
"deactivated" => user.info.deactivated, "deactivated" => user.info.deactivated,
"id" => user.id, "id" => user.id,
"nickname" => user.nickname, "nickname" => user.nickname,
"roles" => %{"admin" => false, "moderator" => false} "roles" => %{"admin" => false, "moderator" => false},
"local" => true,
"tags" => []
} }
] ]
} }
@ -436,7 +444,9 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do
"deactivated" => user2.info.deactivated, "deactivated" => user2.info.deactivated,
"id" => user2.id, "id" => user2.id,
"nickname" => user2.nickname, "nickname" => user2.nickname,
"roles" => %{"admin" => false, "moderator" => false} "roles" => %{"admin" => false, "moderator" => false},
"local" => true,
"tags" => []
} }
] ]
} }
@ -461,7 +471,9 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do
"deactivated" => user.info.deactivated, "deactivated" => user.info.deactivated,
"id" => user.id, "id" => user.id,
"nickname" => user.nickname, "nickname" => user.nickname,
"roles" => %{"admin" => false, "moderator" => false} "roles" => %{"admin" => false, "moderator" => false},
"local" => true,
"tags" => []
} }
] ]
} }
@ -486,13 +498,17 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do
"deactivated" => admin.info.deactivated, "deactivated" => admin.info.deactivated,
"id" => admin.id, "id" => admin.id,
"nickname" => admin.nickname, "nickname" => admin.nickname,
"roles" => %{"admin" => true, "moderator" => false} "roles" => %{"admin" => true, "moderator" => false},
"local" => true,
"tags" => []
}, },
%{ %{
"deactivated" => user.info.deactivated, "deactivated" => user.info.deactivated,
"id" => user.id, "id" => user.id,
"nickname" => user.nickname, "nickname" => user.nickname,
"roles" => %{"admin" => false, "moderator" => false} "roles" => %{"admin" => false, "moderator" => false},
"local" => true,
"tags" => []
} }
] ]
} }
@ -513,7 +529,9 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do
"deactivated" => !user.info.deactivated, "deactivated" => !user.info.deactivated,
"id" => user.id, "id" => user.id,
"nickname" => user.nickname, "nickname" => user.nickname,
"roles" => %{"admin" => false, "moderator" => false} "roles" => %{"admin" => false, "moderator" => false},
"local" => true,
"tags" => []
} }
end end
end end