Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/reference_extractor.rb')
-rw-r--r--lib/gitlab/reference_extractor.rb24
1 files changed, 16 insertions, 8 deletions
diff --git a/lib/gitlab/reference_extractor.rb b/lib/gitlab/reference_extractor.rb
index 540394f04bd..783b68fac12 100644
--- a/lib/gitlab/reference_extractor.rb
+++ b/lib/gitlab/reference_extractor.rb
@@ -4,7 +4,7 @@ module Gitlab
# Extract possible GFM references from an arbitrary String for further processing.
class ReferenceExtractor < Banzai::ReferenceExtractor
REFERABLES = %i(user issue label milestone mentioned_user mentioned_group mentioned_project
- merge_request snippet commit commit_range directly_addressed_user epic iteration vulnerability
+ merge_request snippet commit commit_range directly_addressed_user epic vulnerability
alert).freeze
attr_accessor :project, :current_user, :author
@@ -64,18 +64,24 @@ module Gitlab
end
def all
- REFERABLES.each { |referable| send(referable.to_s.pluralize) } # rubocop:disable GitlabSecurity/PublicSend
+ self.class.referrables.each { |referable| send(referable.to_s.pluralize) } # rubocop:disable GitlabSecurity/PublicSend
@references.values.flatten
end
- def self.references_pattern
- return @pattern if @pattern
+ class << self
+ def references_pattern
+ return @pattern if @pattern
- patterns = REFERABLES.map do |type|
- Banzai::ReferenceParser[type].reference_class.try(:reference_pattern)
- end.uniq
+ patterns = referrables.map do |type|
+ Banzai::ReferenceParser[type].reference_class.try(:reference_pattern)
+ end.uniq
- @pattern = Regexp.union(patterns.compact)
+ @pattern = Regexp.union(patterns.compact)
+ end
+
+ def referrables
+ @referrables ||= REFERABLES
+ end
end
private
@@ -90,3 +96,5 @@ module Gitlab
end
end
end
+
+Gitlab::ReferenceExtractor.prepend_mod