Commit 5349b8d6 authored by Jarka Košanová's avatar Jarka Košanová

Merge branch...

Merge branch '216300-ensure-mr-feedback-creating-an-mr-from-a-remediation-works-as-expected-on-new-standalone-BE' into 'master'

Implement BE for "MR feedback" (creating an MR from a remediation)

See merge request gitlab-org/gitlab!31142
parents 596f481e 0bd3348f
...@@ -14,6 +14,7 @@ module VulnerabilitiesHelper ...@@ -14,6 +14,7 @@ module VulnerabilitiesHelper
has_mr: !!vulnerability.finding.merge_request_feedback.try(:merge_request_iid), has_mr: !!vulnerability.finding.merge_request_feedback.try(:merge_request_iid),
vulnerability_feedback_help_path: help_page_path('user/application_security/index', anchor: 'interacting-with-the-vulnerabilities'), vulnerability_feedback_help_path: help_page_path('user/application_security/index', anchor: 'interacting-with-the-vulnerabilities'),
finding_json: vulnerability_finding_data(vulnerability.finding).to_json, finding_json: vulnerability_finding_data(vulnerability.finding).to_json,
create_mr_url: create_vulnerability_feedback_merge_request_path(vulnerability.finding.project),
timestamp: Time.now.to_i timestamp: Time.now.to_i
} }
end end
...@@ -24,7 +25,8 @@ module VulnerabilitiesHelper ...@@ -24,7 +25,8 @@ module VulnerabilitiesHelper
{ {
id: pipeline.id, id: pipeline.id,
created_at: pipeline.created_at.iso8601, created_at: pipeline.created_at.iso8601,
url: pipeline_path(pipeline) url: pipeline_path(pipeline),
source_branch: pipeline.ref
} }
end end
...@@ -40,7 +42,8 @@ module VulnerabilitiesHelper ...@@ -40,7 +42,8 @@ module VulnerabilitiesHelper
:name, :name,
:issue_feedback, :issue_feedback,
:merge_request_feedback, :merge_request_feedback,
:project :project,
:remediations
).merge( ).merge(
solution: remediation ? remediation['summary'] : occurrence[:solution] solution: remediation ? remediation['summary'] : occurrence[:solution]
) )
......
...@@ -30,6 +30,7 @@ describe VulnerabilitiesHelper do ...@@ -30,6 +30,7 @@ describe VulnerabilitiesHelper do
:name, :name,
:issue_feedback, :issue_feedback,
:project, :project,
:remediations,
:solution :solution
) )
end end
...@@ -64,6 +65,7 @@ describe VulnerabilitiesHelper do ...@@ -64,6 +65,7 @@ describe VulnerabilitiesHelper do
has_mr: anything, has_mr: anything,
vulnerability_feedback_help_path: kind_of(String), vulnerability_feedback_help_path: kind_of(String),
finding_json: kind_of(String), finding_json: kind_of(String),
create_mr_url: "/#{project.full_path}/-/vulnerability_feedback",
timestamp: Time.now.to_i timestamp: Time.now.to_i
) )
end end
...@@ -82,7 +84,8 @@ describe VulnerabilitiesHelper do ...@@ -82,7 +84,8 @@ describe VulnerabilitiesHelper do
expect(pipelineData).to include( expect(pipelineData).to include(
'id' => pipeline.id, 'id' => pipeline.id,
'created_at' => pipeline.created_at.iso8601, 'created_at' => pipeline.created_at.iso8601,
'url' => be_present 'url' => be_present,
'source_branch' => pipeline.ref
) )
end end
end end
...@@ -113,6 +116,7 @@ describe VulnerabilitiesHelper do ...@@ -113,6 +116,7 @@ describe VulnerabilitiesHelper do
location: finding.location, location: finding.location,
name: finding.name, name: finding.name,
project: kind_of(Grape::Entity::Exposure::NestingExposure::OutputBuilder), project: kind_of(Grape::Entity::Exposure::NestingExposure::OutputBuilder),
remediations: finding.remediations,
solution: kind_of(String) solution: kind_of(String)
) )
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