summaryrefslogtreecommitdiff
path: root/app/presenters
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-01-09 12:08:03 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-09 12:08:03 +0000
commitcddaddb86bf6d4d277d206c42a9138a2d660ea56 (patch)
tree92da110e04602b7ea62835e41327e552150279f5 /app/presenters
parent5afd8575506372dd64c238203bd05b4826f3ae2e (diff)
downloadgitlab-ce-cddaddb86bf6d4d277d206c42a9138a2d660ea56.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/presenters')
-rw-r--r--app/presenters/project_presenter.rb25
-rw-r--r--app/presenters/release_presenter.rb2
2 files changed, 23 insertions, 4 deletions
diff --git a/app/presenters/project_presenter.rb b/app/presenters/project_presenter.rb
index 81018398d5d..45f4668112b 100644
--- a/app/presenters/project_presenter.rb
+++ b/app/presenters/project_presenter.rb
@@ -276,8 +276,7 @@ class ProjectPresenter < Gitlab::View::Presenter::Delegated
end
def kubernetes_cluster_anchor_data
- if current_user && can?(current_user, :create_cluster, project)
-
+ if can_instantiate_cluster?
if clusters.empty?
AnchorData.new(false,
statistic_icon + _('Add Kubernetes cluster'),
@@ -294,7 +293,7 @@ class ProjectPresenter < Gitlab::View::Presenter::Delegated
end
def gitlab_ci_anchor_data
- if current_user && can_current_user_push_code? && repository.gitlab_ci_yml.blank? && !auto_devops_enabled?
+ if cicd_missing?
AnchorData.new(false,
statistic_icon + _('Set up CI/CD'),
add_ci_yml_path)
@@ -326,8 +325,28 @@ class ProjectPresenter < Gitlab::View::Presenter::Delegated
count_of_extra_topics_not_shown > 0
end
+ def can_setup_review_app?
+ strong_memoize(:can_setup_review_app) do
+ (can_instantiate_cluster? && all_clusters_empty?) || cicd_missing?
+ end
+ end
+
+ def all_clusters_empty?
+ strong_memoize(:all_clusters_empty) do
+ project.all_clusters.empty?
+ end
+ end
+
private
+ def cicd_missing?
+ current_user && can_current_user_push_code? && repository.gitlab_ci_yml.blank? && !auto_devops_enabled?
+ end
+
+ def can_instantiate_cluster?
+ current_user && can?(current_user, :create_cluster, project)
+ end
+
def filename_path(filename)
if blob = repository.public_send(filename) # rubocop:disable GitlabSecurity/PublicSend
project_blob_path(
diff --git a/app/presenters/release_presenter.rb b/app/presenters/release_presenter.rb
index b38bbc8d96c..099ac9b09cd 100644
--- a/app/presenters/release_presenter.rb
+++ b/app/presenters/release_presenter.rb
@@ -40,7 +40,7 @@ class ReleasePresenter < Gitlab::View::Presenter::Delegated
def evidence_file_path
return unless release.evidence.present?
- evidence_project_release_url(project, tag, format: :json)
+ evidence_project_release_url(project, release.to_param, format: :json)
end
private