summaryrefslogtreecommitdiff
path: root/lib/gitlab/ci/status/deployment/created.rb
blob: 66866a9690b71840cb3893418bf1c5644c9ff6b9 (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
module Gitlab
  module Ci
    module Status
      module Deployment
        class Created < Status::Extended
          def environment_text
            if subject.environment.deployments.any?
              "This job will deploy to %{environment_path} and overwrite the %{deployment_path}."
            else
              "This job will deploy to %{environment_path}."
            end
          end

          def deployment_path
            return unless subject.environment.last_successful_deployment

            project_job_path(subject.project, subject.environment.last_successful_deployment.deployable)
          end

          def self.matches?(deployment, user)
            deployment.created?
          end
        end
      end
    end
  end
end