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

branch_rules_resolver.rb « projects « resolvers « graphql « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d1b39df602fbb84f4d6b2940a03defdebf2af228 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# frozen_string_literal: true

module Resolvers
  module Projects
    class BranchRulesResolver < BaseResolver
      include LooksAhead

      type Types::Projects::BranchRuleType.connection_type, null: false

      alias_method :project, :object

      def resolve_with_lookahead(**args)
        protected_branches.map do |protected_branch|
          ::Projects::BranchRule.new(project, protected_branch)
        end
      end

      private

      def protected_branches
        apply_lookahead(project.protected_branches.sorted_by_name)
      end
    end
  end
end

Resolvers::Projects::BranchRulesResolver.prepend_mod_with('Resolvers::Projects::BranchRulesResolver')