Commit 9876141b authored by Michał Zając's avatar Michał Zając

Allow vulnerability_data to return links for users

parent 2227509d
# frozen_string_literal: true # frozen_string_literal: true
module VulnerabilitiesHelper module VulnerabilitiesHelper
def vulnerability_data(vulnerability, pipeline) def vulnerability_data(vulnerability, pipeline, current_user: nil)
return unless vulnerability return unless vulnerability
{ {
...@@ -9,10 +9,9 @@ module VulnerabilitiesHelper ...@@ -9,10 +9,9 @@ module VulnerabilitiesHelper
project_fingerprint: vulnerability.finding.project_fingerprint, project_fingerprint: vulnerability.finding.project_fingerprint,
create_issue_url: create_vulnerability_feedback_issue_path(vulnerability.finding.project), create_issue_url: create_vulnerability_feedback_issue_path(vulnerability.finding.project),
pipeline_json: vulnerability_pipeline_data(pipeline).to_json, pipeline_json: vulnerability_pipeline_data(pipeline).to_json,
finding: Vulnerabilities::OccurrenceSerializer.new({}).represent(@vulnerability.finding).to_json, 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, current_user: current_user).to_json
} }
end end
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
- page_title @vulnerability.title - page_title @vulnerability.title
- page_description @vulnerability.description - page_description @vulnerability.description
#js-vulnerability-management-app{ data: vulnerability_data(@vulnerability, @pipeline) } #js-vulnerability-management-app{ data: vulnerability_data(@vulnerability, @pipeline, current_user: @current_user) }
.issue-details.issuable-details .issue-details.issuable-details
.detail-page-description .detail-page-description
......
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