Commit 5920b4a5 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch '26595-fix-issue-preselected-template' into 'master'

Fix linking to new issue with selected template

Closes #26595

See merge request !10155
parents 89ecd8ab 5107f6b3
...@@ -251,7 +251,7 @@ module IssuablesHelper ...@@ -251,7 +251,7 @@ 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
def issuable_todo_button_data(issuable, todo, is_collapsed) def issuable_todo_button_data(issuable, todo, is_collapsed)
......
---
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