diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-17 03:06:11 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-17 03:06:11 +0300 |
commit | 48c77599ca5d833ce01ca310af4887200875174f (patch) | |
tree | aade7cdac1b3f5ee266f5df1caf3b745dcd14a8d /app | |
parent | 274ea604fcd43ecccfba04756a9475a3efa47de0 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/projects/pipelines_controller.rb | 3 | ||||
-rw-r--r-- | app/services/projects/create_from_template_service.rb | 23 |
2 files changed, 25 insertions, 1 deletions
diff --git a/app/controllers/projects/pipelines_controller.rb b/app/controllers/projects/pipelines_controller.rb index 28c25dbc1e6..10a6d2d3f26 100644 --- a/app/controllers/projects/pipelines_controller.rb +++ b/app/controllers/projects/pipelines_controller.rb @@ -8,6 +8,9 @@ class Projects::PipelinesController < Projects::ApplicationController before_action :authorize_read_build!, only: [:index] before_action :authorize_create_pipeline!, only: [:new, :create] before_action :authorize_update_pipeline!, only: [:retry, :cancel] + before_action do + push_frontend_feature_flag(:hide_dismissed_vulnerabilities) + end around_action :allow_gitaly_ref_name_caching, only: [:index, :show] diff --git a/app/services/projects/create_from_template_service.rb b/app/services/projects/create_from_template_service.rb index 31977a7c76a..91ece024e13 100644 --- a/app/services/projects/create_from_template_service.rb +++ b/app/services/projects/create_from_template_service.rb @@ -9,7 +9,9 @@ module Projects end def execute - file = Gitlab::ProjectTemplate.find(template_name)&.file + return project unless validate_template! + + file = built_in_template&.file override_params = params.dup params[:file] = file @@ -24,6 +26,25 @@ module Projects params.delete(:template_name).presence end end + + private + + def validate_template! + return true if built_in_template + + project.errors.add(:template_name, _("'%{template_name}' is unknown or invalid" % { template_name: template_name })) + false + end + + def built_in_template + strong_memoize(:built_in_template) do + Gitlab::ProjectTemplate.find(template_name) + end + end + + def project + @project ||= ::Project.new(namespace_id: params[:namespace_id]) + end end end |