debian-mirror-gitlab/app/graphql/resolvers/users/snippets_resolver.rb

30 lines
677 B
Ruby
Raw Normal View History

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 Users
class SnippetsResolver < BaseResolver
include ResolvesSnippets
2021-04-29 21:17:54 +05:30
include Gitlab::Allowable
2020-01-01 13:55:28 +05:30
alias_method :user, :object
argument :type, Types::Snippets::TypeEnum,
required: false,
2021-03-08 18:12:59 +05:30
description: 'The type of snippet.'
2020-01-01 13:55:28 +05:30
private
2021-04-29 21:17:54 +05:30
def resolve_snippets(_args)
return Snippet.none unless Ability.allowed?(current_user, :read_user_profile, user)
super
end
2020-01-01 13:55:28 +05:30
def snippet_finder_params(args)
super.merge(author: user)
end
end
end
end