summaryrefslogtreecommitdiff
path: root/lib/gitlab/ci/status/deployment/created.rb
blob: 84611d6de62654f6c9ab3acd728e2a3bb8ef1b69 (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
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 %{environmentLink} and overwrite the %{deploymentLink}."
            else
              "This job will deploy to %{environmentLink}."
            end
          end

          def deployment_link
            project_deployment_path(subject.project, subject.environment.last_successful_deployment)
          end

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