2020-01-01 13:55:28 +05:30
|
|
|
# frozen_string_literal: true
|
2021-01-29 00:20:46 +05:30
|
|
|
# rubocop:disable Graphql/ResolverType (inherited from ResolvesSnippets)
|
2020-01-01 13:55:28 +05:30
|
|
|
|
|
|
|
module Resolvers
|
|
|
|
module Projects
|
|
|
|
class SnippetsResolver < BaseResolver
|
|
|
|
include ResolvesSnippets
|
|
|
|
|
|
|
|
alias_method :project, :object
|
|
|
|
|
|
|
|
def resolve(**args)
|
|
|
|
return Snippet.none if project.nil?
|
|
|
|
|
2020-04-08 14:13:33 +05:30
|
|
|
unless project.feature_available?(:snippets, current_user)
|
|
|
|
raise Gitlab::Graphql::Errors::ResourceNotAvailable,
|
|
|
|
'Snippets are not enabled for this Project'
|
|
|
|
end
|
|
|
|
|
2020-01-01 13:55:28 +05:30
|
|
|
super
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def snippet_finder_params(args)
|
|
|
|
super.merge(project: project)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|