summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/gitlab/markdown/reference_gatherer_filter.rb2
-rw-r--r--lib/gitlab/reference_extractor.rb8
2 files changed, 8 insertions, 2 deletions
diff --git a/lib/gitlab/markdown/reference_gatherer_filter.rb b/lib/gitlab/markdown/reference_gatherer_filter.rb
index 31fb71a98a3..00f983675e6 100644
--- a/lib/gitlab/markdown/reference_gatherer_filter.rb
+++ b/lib/gitlab/markdown/reference_gatherer_filter.rb
@@ -33,6 +33,8 @@ module Gitlab
reference_type = node.attr('data-reference-filter')
reference_filter = reference_type.constantize
+ return if context[:reference_filter] && reference_filter != context[:reference_filter]
+
return unless reference_filter.user_can_reference?(current_user, node, context)
references = reference_filter.referenced_by(node)
diff --git a/lib/gitlab/reference_extractor.rb b/lib/gitlab/reference_extractor.rb
index 895a23ddcc8..66016ecc877 100644
--- a/lib/gitlab/reference_extractor.rb
+++ b/lib/gitlab/reference_extractor.rb
@@ -40,16 +40,20 @@ module Gitlab
#
# Returns the results Array for the requested filter type
def pipeline_result(filter_type)
- klass = filter_type.to_s.camelize + 'ReferenceFilter'
+ klass = "#{filter_type.to_s.camelize}ReferenceFilter"
filter = Gitlab::Markdown.const_get(klass)
context = {
project: project,
current_user: current_user,
+
# We don't actually care about the links generated
only_path: true,
ignore_blockquotes: true,
- load_lazy_references: false
+
+ # ReferenceGathererFilter
+ load_lazy_references: false,
+ reference_filter: filter
}
pipeline = HTML::Pipeline.new([filter, Gitlab::Markdown::ReferenceGathererFilter], context)