summaryrefslogtreecommitdiff
path: root/lib/gitlab/ci/status/bridge/common.rb
blob: eaa87157716d234d5c094e8f19ce3818792b1c9a (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
# frozen_string_literal: true

module Gitlab
  module Ci
    module Status
      module Bridge
        module Common
          def label
            subject.description
          end

          def has_details?
            !!details_path
          end

          def details_path
            return unless can?(user, :read_pipeline, downstream_pipeline)

            if Feature.enabled?(:ci_retry_downstream_pipeline, subject.project, default_enabled: :yaml)
              project_job_path(subject.project, subject)
            else
              project_pipeline_path(downstream_project, downstream_pipeline)
            end
          end

          def has_action?
            false
          end

          private

          def downstream_pipeline
            subject.downstream_pipeline
          end

          def downstream_project
            downstream_pipeline&.project
          end
        end
      end
    end
  end
end