Commit 3effc546 authored by Ash McKenzie's avatar Ash McKenzie

Merge branch...

Merge branch '217658-rename-vulnerabilities-occurrencespreloader-to-vulnerabilities-findingspreloader' into 'master'

Rename Vulnerabilities::OccurrencesPreloader to FindingsPreloader

See merge request gitlab-org/gitlab!31982
parents 52cdad05 b8c6975b
...@@ -11,7 +11,7 @@ class Vulnerabilities::OccurrenceSerializer < BaseSerializer ...@@ -11,7 +11,7 @@ class Vulnerabilities::OccurrenceSerializer < BaseSerializer
end end
if opts.delete(:preload) if opts.delete(:preload)
resource = Gitlab::Vulnerabilities::OccurrencesPreloader.preload!(resource) resource = Gitlab::Vulnerabilities::FindingsPreloader.preload!(resource)
end end
super(resource, opts) super(resource, opts)
......
...@@ -72,7 +72,7 @@ module API ...@@ -72,7 +72,7 @@ module API
) )
) )
Gitlab::Vulnerabilities::OccurrencesPreloader.preload_feedback!(vulnerability_occurrences) Gitlab::Vulnerabilities::FindingsPreloader.preload_feedback!(vulnerability_occurrences)
present vulnerability_occurrences, present vulnerability_occurrences,
with: ::Vulnerabilities::FindingEntity, with: ::Vulnerabilities::FindingEntity,
......
# frozen_string_literal: true # frozen_string_literal: true
module Gitlab module Gitlab
# Preloading of Vulnerabilities Occurrences. # Preloading of Vulnerabilities Findings.
# #
# This class can be used to efficiently preload the feedback of a given list of # This class can be used to efficiently preload the feedback of a given list of
# vulnerabilities (occurrences). # vulnerabilities (findings).
module Vulnerabilities module Vulnerabilities
class OccurrencesPreloader class FindingsPreloader
def self.preload!(occurrences) def self.preload!(findings)
occurrences.all_preloaded.tap do |occurrences| findings.all_preloaded.tap do |findings|
preload_feedback!(occurrences) preload_feedback!(findings)
end end
end end
def self.preload_feedback!(occurrences) def self.preload_feedback!(findings)
occurrences.each do |occurrence| findings.each do |finding|
occurrence.dismissal_feedback finding.dismissal_feedback
occurrence.issue_feedback finding.issue_feedback
occurrence.merge_request_feedback finding.merge_request_feedback
end end
end end
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