diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-12-15 16:57:11 +0100 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-12-15 16:57:11 +0100 |
commit | 6560d053ed0c2d5b0a00918e64417bd6b1de4d73 (patch) | |
tree | 84c265f19d8c38adbc19642640775a56d1ac4cb1 | |
parent | 48b3ad6d373ea478c12287d11815aef805f0c2a6 (diff) | |
download | gitlab-ce-6560d053ed0c2d5b0a00918e64417bd6b1de4d73.tar.gz |
Use lazy reference extractor to get issue's MRslazy-reference-extractor
-rw-r--r-- | app/models/issue.rb | 10 | ||||
-rw-r--r-- | lib/banzai/reference_extractor.rb | 2 |
2 files changed, 6 insertions, 6 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb index 9f4f4923e58..4571d7f0ee1 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -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 diff --git a/lib/banzai/reference_extractor.rb b/lib/banzai/reference_extractor.rb index 8ae5b890953..2c197d31898 100644 --- a/lib/banzai/reference_extractor.rb +++ b/lib/banzai/reference_extractor.rb @@ -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 |