Commit 5107f6b3 authored by Eric Eastwood's avatar Eric Eastwood

Fix linking to new issue with selected template

Fix https://gitlab.com/gitlab-org/gitlab-ce/issues/26595
parent 6460489b
...@@ -251,6 +251,6 @@ module IssuablesHelper ...@@ -251,6 +251,6 @@ module IssuablesHelper
end end
def selected_template(issuable) def selected_template(issuable)
params[:issuable_template] if issuable_templates(issuable).include?(params[:issuable_template]) params[:issuable_template] if issuable_templates(issuable).any?{ |template| template[:name] == params[:issuable_template] }
end end
end end
---
title: Fix linking to new issue with selected template via url parameter
merge_request:
author:
...@@ -13,6 +13,13 @@ describe 'Issues', feature: true do ...@@ -13,6 +13,13 @@ describe 'Issues', feature: true do
user2 = create(:user) user2 = create(:user)
project.team << [[@user, user2], :developer] project.team << [[@user, user2], :developer]
project.repository.create_file(
@user,
'.gitlab/issue_templates/bug.md',
'this is a test "bug" template',
message: 'added issue template',
branch_name: 'master')
end end
describe 'Edit issue' do describe 'Edit issue' do
...@@ -600,6 +607,16 @@ describe 'Issues', feature: true do ...@@ -600,6 +607,16 @@ describe 'Issues', feature: true do
expect(page.find_field("issue_description").value).to match /\n\n$/ expect(page.find_field("issue_description").value).to match /\n\n$/
end end
end end
context 'form filled by URL parameters' do
before do
visit new_namespace_project_issue_path(project.namespace, project, issuable_template: 'bug')
end
it 'fills in template' do
expect(find('.js-issuable-selector .dropdown-toggle-text')).to have_content('bug')
end
end
end end
describe 'new issue by email' do describe 'new issue by email' do
......
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