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 @@ def render("show.json", %{user: user}) do
"id" => user.id,
"nickname" => user.nickname,
"deactivated" => user.info.deactivated,
"roles" => Info.roles(user.info)
"local" => user.local,
"roles" => Info.roles(user.info),
"tags" => user.tags || []
}
end
end

View file

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