BigW Consortium Gitlab

Commit 04ae6587 by Douwe Maan

Merge branch 'fj-42601-respect-visibility-options' into 'master'

Respect visibility options and description when importing project from template Closes #42601 See merge request gitlab-org/gitlab-ce!18473
parents 6c868a01 92deabb3
...@@ -8,9 +8,10 @@ module Projects ...@@ -8,9 +8,10 @@ module Projects
template_name = params.delete(:template_name) template_name = params.delete(:template_name)
file = Gitlab::ProjectTemplate.find(template_name).file file = Gitlab::ProjectTemplate.find(template_name).file
override_params = params.dup
params[:file] = file params[:file] = file
GitlabProjectsImportService.new(current_user, params).execute GitlabProjectsImportService.new(current_user, params, override_params).execute
ensure ensure
file&.close file&.close
......
---
title: Respect visibility options and description when importing project from template
merge_request: 18473
author:
type: fixed
...@@ -7,7 +7,7 @@ describe Projects::CreateFromTemplateService do ...@@ -7,7 +7,7 @@ describe Projects::CreateFromTemplateService do
path: user.to_param, path: user.to_param,
template_name: 'rails', template_name: 'rails',
description: 'project description', description: 'project description',
visibility_level: Gitlab::VisibilityLevel::PRIVATE visibility_level: Gitlab::VisibilityLevel::PUBLIC
} }
end end
...@@ -24,7 +24,23 @@ describe Projects::CreateFromTemplateService do ...@@ -24,7 +24,23 @@ describe Projects::CreateFromTemplateService do
expect(project).to be_saved expect(project).to be_saved
expect(project.scheduled?).to be(true) expect(project.scheduled?).to be(true)
expect(project.description).to match('project description') end
expect(project.visibility_level).to eq(Gitlab::VisibilityLevel::PRIVATE)
context 'the result project' do
before do
Sidekiq::Testing.inline! do
@project = subject.execute
end
@project.reload
end
it 'overrides template description' do
expect(@project.description).to match('project description')
end
it 'overrides template visibility_level' do
expect(@project.visibility_level).to eq(Gitlab::VisibilityLevel::PUBLIC)
end
end end
end end
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