Welcome to mirror list, hosted at ThFree Co, Russian Federation.

search_arguments.rb « concerns « resolvers « graphql « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7f480f9d0b61484e20e5f6e025f4e7f0cfc58c93 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# frozen_string_literal: true

module SearchArguments
  extend ActiveSupport::Concern

  included do
    argument :search, GraphQL::Types::String,
             required: false,
             description: 'Search query for title or description.'
  end

  def validate_anonymous_search_access!
    return if current_user.present? || Feature.disabled?(:disable_anonymous_search, type: :ops)

    raise ::Gitlab::Graphql::Errors::ArgumentError,
      "User must be authenticated to include the `search` argument."
  end
end