Commit 684e1d15 authored by Jonathan Schafer's avatar Jonathan Schafer Committed by Dmytro Zaporozhets (DZ)

Do not overwrite fields that are populated

parent 15b9bc05
...@@ -66,10 +66,12 @@ module EE ...@@ -66,10 +66,12 @@ module EE
end end
def vulnerability_issue_build_parameters def vulnerability_issue_build_parameters
issue = params[:issue]
{ {
title: _("Investigate vulnerability: %{title}") % { title: vulnerability.title }, title: issue.fetch(:title, _("Investigate vulnerability: %{title}") % { title: vulnerability.title }),
description: render_vulnerability_description, description: issue.fetch(:description, render_vulnerability_description),
confidential: true confidential: issue.fetch(:confidential, true)
} }
end end
......
---
title: Fixed bug that overwrote issue description changes from vulnerabilities
merge_request: 52376
author:
type: fixed
...@@ -104,6 +104,15 @@ RSpec.describe Projects::IssuesController do ...@@ -104,6 +104,15 @@ RSpec.describe Projects::IssuesController do
expect(project.issues.last.vulnerability_links.first.vulnerability).to eq(vulnerability) expect(project.issues.last.vulnerability_links.first.vulnerability).to eq(vulnerability)
end end
it 'overwrites the default fields' do
send_request
issue = project.issues.last
expect(issue.title).to eq('Title')
expect(issue.description).to eq('Description')
expect(issue.confidential).to be false
end
context 'when vulnerability already has a linked issue' do context 'when vulnerability already has a linked issue' do
render_views render_views
...@@ -123,7 +132,7 @@ RSpec.describe Projects::IssuesController do ...@@ -123,7 +132,7 @@ RSpec.describe Projects::IssuesController do
post :create, params: { post :create, params: {
namespace_id: project.namespace.to_param, namespace_id: project.namespace.to_param,
project_id: project, project_id: project,
issue: { title: 'Title', description: 'Description' }, issue: { title: 'Title', description: 'Description', confidential: 'false' },
vulnerability_id: vulnerability.id vulnerability_id: vulnerability.id
} }
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