diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2018-11-12 13:50:31 +0100 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2018-11-12 13:50:31 +0100 |
commit | 9aa705dd38045b1121557faddf789ce8e114fc7d (patch) | |
tree | f5915719950036b47bd5c75e2dcaac3a5e8c380c /app/models/project_services | |
parent | f5e3ce5ed612c9b247e362ed7c667557331e5bfd (diff) | |
download | gitlab-ce-9aa705dd38045b1121557faddf789ce8e114fc7d.tar.gz |
Turn reference regex constants into methods
`Mentionable::ReferenceRegexes` used to define the following two
constants:
1. DEFAULT_PATTERN
2. EXTERNAL_PATTERN
These two constants were built using some of the class methods that
reside in this same module. In EE we redefine one of these methods by
using `prepend` at the start of the `ReferenceRegexes` module. This
poses a problem: we can not move the `prepend` to the end of the file,
because the constants later on depend on it.
To resolve this problem, this commit turns these constants into class
methods that memoize their results. This allows EE to redefine the
appropriate methods before these two class methods are used, in turn
allowing us to move the `prepend` to the end of the file.
See https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/8198 for more
information.
Diffstat (limited to 'app/models/project_services')
-rw-r--r-- | app/models/project_services/issue_tracker_service.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/project_services/issue_tracker_service.rb b/app/models/project_services/issue_tracker_service.rb index a399982e5ec..f54497fc6d8 100644 --- a/app/models/project_services/issue_tracker_service.rb +++ b/app/models/project_services/issue_tracker_service.rb @@ -9,7 +9,7 @@ class IssueTrackerService < Service # Override this method on services that uses different patterns # This pattern does not support cross-project references # The other code assumes that this pattern is a superset of all - # overridden patterns. See ReferenceRegexes::EXTERNAL_PATTERN + # overridden patterns. See ReferenceRegexes.external_pattern def self.reference_pattern(only_long: false) if only_long /(\b[A-Z][A-Z0-9_]*-)(?<issue>\d+)/ |