summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2018-10-17 18:13:53 +0900
committerShinya Maeda <shinya@gitlab.com>2018-10-17 18:13:53 +0900
commitd6e62bffad5e313fcc3abb6a2391e25c05f3caa0 (patch)
tree34ff7371c9a544882f9f18c9bacf2bc04fb839dd
parentbfa6577518b5b34f3fab314f32b48255e443b9bc (diff)
downloadgitlab-ce-d6e62bffad5e313fcc3abb6a2391e25c05f3caa0.tar.gz
Fix methods in common
-rw-r--r--lib/gitlab/ci/status/deployment/common.rb23
1 files changed, 16 insertions, 7 deletions
diff --git a/lib/gitlab/ci/status/deployment/common.rb b/lib/gitlab/ci/status/deployment/common.rb
index a552592c02c..64bb7c4e032 100644
--- a/lib/gitlab/ci/status/deployment/common.rb
+++ b/lib/gitlab/ci/status/deployment/common.rb
@@ -4,12 +4,12 @@ module Gitlab
module Deployment
module Common
def has_details?
- can?(current_user, :read_environment, environment) &&
+ can?(user, :read_environment, environment) &&
can?(user, :read_deployment, subject)
end
def details_path
- project_job_path(subject.project, subject.deployable)
+ project_job_path(project, deployable)
end
def environment_name
@@ -17,11 +17,11 @@ module Gitlab
end
def environment_path
- project_environment_path(subject.project, subject.environment)
+ project_environment_path(project, environment)
end
def deployment_path
- project_job_path(subject.project, subject.deployable)
+ project_job_path(project, deployable)
end
def external_url
@@ -29,7 +29,7 @@ module Gitlab
end
def stop_url
- if can?(current_user, :stop_environment, environment)
+ if can?(user, :stop_environment, environment)
stop_project_environment_path(project, environment)
end
end
@@ -41,7 +41,8 @@ module Gitlab
end
def metrics_monitoring_url
- environment_metrics_path(environment)
+ # environment_metrics_path(environment)
+ metrics_project_environment_path(project, environment)
end
def deployed_at
@@ -49,12 +50,20 @@ module Gitlab
end
def deployed_at_formatted
- subject.deployed_at_formatted
+ subject.formatted_deployment_time
end
def environment
subject.environment
end
+
+ def project
+ subject.project
+ end
+
+ def deployable
+ subject.deployable
+ end
end
end
end