Commit d95d1e5d authored by Steve Mokris's avatar Steve Mokris Committed by Markus Koller

Prepopulate new issue with link to the parent

At the top of each issue detail view, there's a "New issue" link in the
dropdown menu.  Modify that link to prepopulate the newly-created issue
with a link to the original issue, to make it easier to create
interconnected issues without having to copy-paste or memorize the
parent issue id.

Changelog: changed
parent 10932045
......@@ -174,7 +174,11 @@ module IssuesHelper
end
def issue_header_actions_data(project, issuable, current_user)
new_issuable_params = ({ issuable_template: 'incident', issue: { issue_type: 'incident' } } if issuable.incident?)
new_issuable_params = { issue: { description: _('Related to #%{issue_id}.') % { issue_id: issuable.iid } + "\n\n" } }
if issuable.incident?
new_issuable_params[:issuable_template] = 'incident'
new_issuable_params[:issue][:issue_type] = 'incident'
end
{
can_create_issue: show_new_issue_link?(project).to_s,
......
......@@ -27647,6 +27647,9 @@ msgstr ""
msgid "Related merge requests"
msgstr ""
msgid "Related to #%{issue_id}."
msgstr ""
msgid "Relates to"
msgstr ""
......
......@@ -25,7 +25,7 @@ RSpec.describe "User views incident" do
it 'shows the merge request and incident actions', :js, :aggregate_failures do
click_button 'Incident actions'
expect(page).to have_link('New incident', href: new_project_issue_path(project, { issuable_template: 'incident', issue: { issue_type: 'incident' } }))
expect(page).to have_link('New incident', href: new_project_issue_path(project, { issuable_template: 'incident', issue: { issue_type: 'incident', description: "Related to \##{incident.iid}.\n\n" } }))
expect(page).to have_button('Create merge request')
expect(page).to have_button('Close incident')
end
......
......@@ -25,7 +25,7 @@ RSpec.describe "User views issue" do
it 'shows the merge request and issue actions', :js, :aggregate_failures do
click_button 'Issue actions'
expect(page).to have_link('New issue', href: new_project_issue_path(project))
expect(page).to have_link('New issue', href: new_project_issue_path(project, { issue: { description: "Related to \##{issue.iid}.\n\n" } }))
expect(page).to have_button('Create merge request')
expect(page).to have_button('Close issue')
end
......
......@@ -284,7 +284,7 @@ RSpec.describe IssuesHelper do
iid: issue.iid,
is_issue_author: 'false',
issue_type: 'issue',
new_issue_path: new_project_issue_path(project),
new_issue_path: new_project_issue_path(project, { issue: { description: "Related to \##{issue.iid}.\n\n" } }),
project_path: project.full_path,
report_abuse_path: new_abuse_report_path(user_id: issue.author.id, ref_url: issue_url(issue)),
submit_as_spam_path: mark_as_spam_project_issue_path(project, issue)
......
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