diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-19 11:27:35 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-19 11:27:35 +0300 |
commit | 7e9c479f7de77702622631cff2628a9c8dcbc627 (patch) | |
tree | c8f718a08e110ad7e1894510980d2155a6549197 /app/graphql/resolvers/users_resolver.rb | |
parent | e852b0ae16db4052c1c567d9efa4facc81146e88 (diff) |
Add latest changes from gitlab-org/gitlab@13-6-stable-eev13.6.0-rc42
Diffstat (limited to 'app/graphql/resolvers/users_resolver.rb')
-rw-r--r-- | app/graphql/resolvers/users_resolver.rb | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/app/graphql/resolvers/users_resolver.rb b/app/graphql/resolvers/users_resolver.rb index 110a283b42e..f5838642141 100644 --- a/app/graphql/resolvers/users_resolver.rb +++ b/app/graphql/resolvers/users_resolver.rb @@ -4,6 +4,7 @@ module Resolvers class UsersResolver < BaseResolver include Gitlab::Graphql::Authorize::AuthorizeResource + type Types::UserType.connection_type, null: true description 'Find Users' argument :ids, [GraphQL::ID_TYPE], @@ -18,10 +19,14 @@ module Resolvers required: false, default_value: 'created_desc' - def resolve(ids: nil, usernames: nil, sort: nil) + argument :search, GraphQL::STRING_TYPE, + required: false, + description: "Query to search users by name, username, or primary email." + + def resolve(ids: nil, usernames: nil, sort: nil, search: nil) authorize! - ::UsersFinder.new(context[:current_user], finder_params(ids, usernames, sort)).execute + ::UsersFinder.new(context[:current_user], finder_params(ids, usernames, sort, search)).execute end def ready?(**args) @@ -42,11 +47,12 @@ module Resolvers private - def finder_params(ids, usernames, sort) + def finder_params(ids, usernames, sort, search) params = {} params[:sort] = sort if sort params[:username] = usernames if usernames params[:id] = parse_gids(ids) if ids + params[:search] = search if search params end |