debian-mirror-gitlab/app/graphql/resolvers/concerns/search_arguments.rb

19 lines
519 B
Ruby
Raw Normal View History

2021-11-18 22:05:49 +05:30
# 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