summaryrefslogtreecommitdiff
path: root/lib/banzai/filter/abstract_reference_filter.rb
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2016-06-28 17:50:17 +0200
committerYorick Peterse <yorickpeterse@gmail.com>2016-06-30 11:52:44 +0200
commita4ce2d126d969722af7152c4be2c8a6dde3104b5 (patch)
treed65701227d80752d4a6cd583af9a082866bbc2ab /lib/banzai/filter/abstract_reference_filter.rb
parentbef4294c58e0bbadc01f633fc8bea514801de7ae (diff)
downloadgitlab-ce-a4ce2d126d969722af7152c4be2c8a6dde3104b5.tar.gz
Handle external issues in IssueReferenceFilter
IssueReferenceFilter will end up processing internal issue references when a project uses an external issues tracker while still using internal issue references (in the form of `#\d+`). This commit ensures that these links are rendered as external issue links, regardless of whether the project one currently views uses an internal or external issues tracker. Fixes gitlab-org/gitlab-ce#19036, gitlab-com/performance#16
Diffstat (limited to 'lib/banzai/filter/abstract_reference_filter.rb')
-rw-r--r--lib/banzai/filter/abstract_reference_filter.rb14
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/banzai/filter/abstract_reference_filter.rb b/lib/banzai/filter/abstract_reference_filter.rb
index 81d66271136..d77a5e3ff09 100644
--- a/lib/banzai/filter/abstract_reference_filter.rb
+++ b/lib/banzai/filter/abstract_reference_filter.rb
@@ -160,11 +160,7 @@ module Banzai
title = object_link_title(object)
klass = reference_class(object_sym)
- data = data_attribute(
- original: link_text || match,
- project: project.id,
- object_sym => object.id
- )
+ data = data_attributes_for(link_text || match, project, object)
if matches.names.include?("url") && matches[:url]
url = matches[:url]
@@ -183,6 +179,14 @@ module Banzai
end
end
+ def data_attributes_for(text, project, object)
+ data_attribute(
+ original: text,
+ project: project.id,
+ object_sym => object.id
+ )
+ end
+
def object_link_text_extras(object, matches)
extras = []