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