diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-09 03:06:06 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-09 03:06:06 +0300 |
commit | 869182cab0867d582e469f329a6f58d13f877683 (patch) | |
tree | b98d8834894848f5ce845b7efc84681d51083695 /app/services | |
parent | a82d0c740b338ad981321a3111b731ad78364ba1 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/projects/create_from_template_service.rb | 9 | ||||
-rw-r--r-- | app/services/projects/create_service.rb | 6 |
2 files changed, 8 insertions, 7 deletions
diff --git a/app/services/projects/create_from_template_service.rb b/app/services/projects/create_from_template_service.rb index 91ece024e13..a207fd2c574 100644 --- a/app/services/projects/create_from_template_service.rb +++ b/app/services/projects/create_from_template_service.rb @@ -4,8 +4,11 @@ module Projects class CreateFromTemplateService < BaseService include Gitlab::Utils::StrongMemoize + attr_reader :template_name + def initialize(user, params) @current_user, @params = user, params.to_h.dup + @template_name = @params.delete(:template_name).presence end def execute @@ -21,12 +24,6 @@ module Projects file&.close end - def template_name - strong_memoize(:template_name) do - params.delete(:template_name).presence - end - end - private def validate_template! diff --git a/app/services/projects/create_service.rb b/app/services/projects/create_service.rb index 728eb039b54..ef06545b27d 100644 --- a/app/services/projects/create_service.rb +++ b/app/services/projects/create_service.rb @@ -13,7 +13,7 @@ module Projects end def execute - if @params[:template_name].present? + if create_from_template? return ::Projects::CreateFromTemplateService.new(current_user, params).execute end @@ -184,6 +184,10 @@ module Projects private + def create_from_template? + @params[:template_name].present? || @params[:template_project_id].present? + end + def import_schedule if @project.errors.empty? @project.import_state.schedule if @project.import? && !@project.bare_repository_import? |