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

            project_pipeline_path(downstream_project, downstream_pipeline)
          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