未验证 提交 573bdbe3 编写于 作者: J Jijoong Kim 提交者: GitHub

Add is_active field in UserFilter (#3235)

* Add is_active field in UserFilter

* Update changelog

* Add is_active as a default searchParam to get user list

* Fix url search query

* Update CHANGELOG.md
Co-authored-by: NNikita Manovich <nikita.manovich@intel.com>
上级 e0fe9c15
......@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Support of context images for 2D image tasks (<https://github.com/openvinotoolkit/cvat/pull/3122>)
- Filter `is_active` for user list (<https://github.com/openvinotoolkit/cvat/pull/3235>)
### Changed
......
......@@ -115,6 +115,7 @@
cvat.users.get.implementation = async (filter) => {
checkFilter(filter, {
id: isInteger,
is_active: isBoolean,
self: isBoolean,
search: isString,
limit: isInteger,
......@@ -125,7 +126,10 @@
users = await serverProxy.users.self();
users = [users];
} else {
const searchParams = {};
// get list of active users as default
const searchParams = {
is_active: true,
};
for (const key in filter) {
if (filter[key] && key !== 'self') {
searchParams[key] = filter[key];
......
......@@ -921,11 +921,12 @@ class CommentViewSet(viewsets.GenericViewSet,
class UserFilter(filters.FilterSet):
class Meta:
model = User
fields = ("id",)
fields = ("id", "is_active")
@method_decorator(name='list', decorator=swagger_auto_schema(
manual_parameters=[
openapi.Parameter('id',openapi.IN_QUERY,description="A unique number value identifying this user",type=openapi.TYPE_NUMBER),
openapi.Parameter('is_active',openapi.IN_QUERY,description="Returns only active users",type=openapi.TYPE_BOOLEAN),
],
operation_summary='Method provides a paginated list of users registered on the server'))
@method_decorator(name='retrieve', decorator=swagger_auto_schema(
......
......@@ -157,7 +157,7 @@ Cypress.Commands.add('submitReview', (decision, user) => {
cy.get('.cvat-submit-review-dialog').within(() => {
cy.contains(new RegExp(`^${decision}$`, 'g')).click();
if (decision === 'Review next') {
cy.intercept('GET', `/api/v1/users?search=${user}&limit=10`).as('searchUsers');
cy.intercept('GET', `/api/v1/users?is_active=true&search=${user}&limit=10`).as('searchUsers');
cy.get('.cvat-user-search-field').within(() => {
cy.get('input[type="search"]').clear().type(`${user}`);
cy.wait('@searchUsers').its('response.statusCode').should('equal', 200);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册