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

fork_details_type.rb « projects « types « graphql « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 6157dc472556c66796223300fd757b2077a6aa5d (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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# frozen_string_literal: true

module Types
  module Projects
    # rubocop: disable Graphql/AuthorizeTypes
    class ForkDetailsType < BaseObject
      graphql_name 'ForkDetails'
      description 'Details of the fork project compared to its upstream project.'

      field :ahead, GraphQL::Types::Int,
            null: true,
            calls_gitaly: true,
            method: :ahead,
            description: 'Number of commits ahead of upstream.'

      field :behind, GraphQL::Types::Int,
            null: true,
            calls_gitaly: true,
            method: :behind,
            description: 'Number of commits behind upstream.'

      field :is_syncing, GraphQL::Types::Boolean,
            null: true,
            method: :syncing?,
            description: 'Indicates if there is a synchronization in progress.'

      field :has_conflicts, GraphQL::Types::Boolean,
            null: true,
            method: :has_conflicts?,
            description: 'Indicates if the fork conflicts with its upstream project.'

      def ahead
        counts[:ahead]
      end

      def behind
        counts[:behind]
      end

      def counts
        @counts ||= object.counts
      end
    end
    # rubocop: enable Graphql/AuthorizeTypes
  end
end