Use lazy reference extractor to get issue's MRs
This commit is contained in:
parent
48b3ad6d37
commit
6560d053ed
|
@ -84,11 +84,11 @@ class Issue < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def referenced_merge_requests
|
||||
references = [self, *notes].flat_map do |note|
|
||||
Gitlab::ReferenceExtractor.lazily do
|
||||
[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)
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue