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
end
if opts.delete(:preload)
resource = Gitlab::Vulnerabilities::OccurrencesPreloader.preload!(resource)
resource = Gitlab::Vulnerabilities::FindingsPreloader.preload!(resource)
end
super(resource, opts)
......
......@@ -72,7 +72,7 @@ module API
)
)
Gitlab::Vulnerabilities::OccurrencesPreloader.preload_feedback!(vulnerability_occurrences)
Gitlab::Vulnerabilities::FindingsPreloader.preload_feedback!(vulnerability_occurrences)
present vulnerability_occurrences,
with: ::Vulnerabilities::FindingEntity,
......
# frozen_string_literal: true
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
# vulnerabilities (occurrences).
# vulnerabilities (findings).
module Vulnerabilities
class OccurrencesPreloader
def self.preload!(occurrences)
occurrences.all_preloaded.tap do |occurrences|
preload_feedback!(occurrences)
class FindingsPreloader
def self.preload!(findings)
findings.all_preloaded.tap do |findings|
preload_feedback!(findings)
end
end
def self.preload_feedback!(occurrences)
occurrences.each do |occurrence|
occurrence.dismissal_feedback
occurrence.issue_feedback
occurrence.merge_request_feedback
def self.preload_feedback!(findings)
findings.each do |finding|
finding.dismissal_feedback
finding.issue_feedback
finding.merge_request_feedback
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