Commit 2f744003 authored by Kamil Trzcinski's avatar Kamil Trzcinski

Properly decide when to show Auto DevOps banner

- Only if user can manage project,
- When Auto DevOps is not enabled,
- When project configuration is set to implicit
parent 8eec0924
module AutoDevOpsHelper
def show_auto_devops_callout?(project)
show_callout?('auto_devops_settings_dismissed') &&
can?(current_user, :admin_pipeline, project) &&
!current_settings.auto_devops_enabled? &&
project.auto_devops&.enabled.nil?
end
end
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
- if @project.merge_requests.exists? - if @project.merge_requests.exists?
%div{ class: container_class } %div{ class: container_class }
-if show_callout?('auto_devops_settings_dismissed') - if show_auto_devops_callout?(@project)
= render 'shared/auto_devops_callout' = render 'shared/auto_devops_callout'
.top-area .top-area
= render 'shared/issuable/nav', type: :merge_requests = render 'shared/issuable/nav', type: :merge_requests
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
= render "projects/pipelines/head" = render "projects/pipelines/head"
%div{ 'class' => container_class } %div{ 'class' => container_class }
-if show_callout?('auto_devops_settings_dismissed') - if show_auto_devops_callout?(@project)
= render 'shared/auto_devops_callout' = render 'shared/auto_devops_callout'
#pipelines-list-vue{ data: { endpoint: project_pipelines_path(@project, format: :json), #pipelines-list-vue{ data: { endpoint: project_pipelines_path(@project, format: :json),
......
...@@ -81,7 +81,7 @@ ...@@ -81,7 +81,7 @@
- view_path = default_project_view - view_path = default_project_view
-if show_callout?('auto_devops_settings_dismissed') - if show_auto_devops_callout?(@project)
= render 'shared/auto_devops_callout' = render 'shared/auto_devops_callout'
%div{ class: project_child_container_class(view_path) } %div{ class: project_child_container_class(view_path) }
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
= render "projects/commits/head" = render "projects/commits/head"
%div{ class: [container_class, ("limit-container-width" unless fluid_layout)] } %div{ class: [container_class, ("limit-container-width" unless fluid_layout)] }
-if show_callout?('auto_devops_settings_dismissed') - if show_auto_devops_callout?(@project)
= render 'shared/auto_devops_callout' = render 'shared/auto_devops_callout'
= render 'projects/last_push' = render 'projects/last_push'
= render 'projects/files', commit: @last_commit, project: @project, ref: @ref, content_url: project_tree_path(@project, @id) = render 'projects/files', commit: @last_commit, project: @project, ref: @ref, content_url: project_tree_path(@project, @id)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment