Commit 6560d053 authored by Douwe Maan's avatar Douwe Maan

Use lazy reference extractor to get issue's MRs

parent 48b3ad6d
......@@ -84,11 +84,11 @@ class Issue < ActiveRecord::Base
end
def referenced_merge_requests
references = [self, *notes].flat_map do |note|
note.all_references(load_lazy_references: false).merge_requests
end.uniq
Banzai::LazyReference.load(references).uniq.sort_by(&:iid)
Gitlab::ReferenceExtractor.lazily do
[self, *notes].flat_map do |note|
note.all_references(load_lazy_references: false).merge_requests
end
end.sort_by(&:iid)
end
# Reset issue events cache
......
......@@ -11,7 +11,7 @@ module Banzai
end
def lazily(values = nil, &block)
return values || block.call if lazy?
return (values || block.call).uniq if lazy?
begin
Thread.current[LAZY_KEY] = true
......
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