Commit c6e37faa authored by Douwe Maan's avatar Douwe Maan

Merge branch 'sh-fix-instance-templates-not-working' into 'master'

Fix instance project templates no longer working

Closes #9038

See merge request gitlab-org/gitlab-ee!9019
parents d8f76ce7 7ba8f3fe
......@@ -28,10 +28,14 @@ module EE
def template_project
strong_memoize(:template_project) do
current_user.available_custom_project_templates(search: template_name, subgroup_id: params[:group_with_project_templates_id])
current_user.available_custom_project_templates(search: template_name, subgroup_id: subgroup_id)
.first
end
end
def subgroup_id
params[:group_with_project_templates_id].presence
end
end
end
end
---
title: Fix instance project templates no longer working
merge_request: 9019
author:
type: fixed
......@@ -69,9 +69,10 @@ describe Projects::CreateFromTemplateService do
end
end
context 'creates project from custom template' do
shared_examples 'creates project from custom template' do |subgroup_id|
# If we move the project inside a let block it throws a SEGFAULT error
before do
project_params[:group_with_project_templates_id] = subgroup_id
@project = subject.execute
end
......@@ -91,6 +92,9 @@ describe Projects::CreateFromTemplateService do
end
end
it_behaves_like 'creates project from custom template', nil
it_behaves_like 'creates project from custom template', ''
describe 'creating project from a Group project template', :postgresql do
let(:project_name) { project_template.name }
let(:group_with_project_templates_id) { subgroup_1.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