summaryrefslogtreecommitdiff
path: root/app/models/issue.rb
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-11-30 21:14:46 +0100
committerDouwe Maan <douwe@gitlab.com>2015-11-30 21:36:34 +0100
commitd6a5b45c8ea5ec7a68e213636fde405c52bb90e4 (patch)
treee711cd92c57e20cc7900875017fb93d670537c00 /app/models/issue.rb
parenta7be01cd07430a4302668224947b2ed135c2d7bb (diff)
downloadgitlab-ce-d6a5b45c8ea5ec7a68e213636fde405c52bb90e4.tar.gz
Recognize issue/MR/snippet/commit links as references.
Diffstat (limited to 'app/models/issue.rb')
-rw-r--r--app/models/issue.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb
index 72183108033..e62acfdfd91 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -64,11 +64,18 @@ class Issue < ActiveRecord::Base
# This pattern supports cross-project references.
def self.reference_pattern
%r{
- (#{Project.reference_pattern})?
- #{Regexp.escape(reference_prefix)}(?<issue>\d+)
+ #{link_reference_pattern} |
+ (?:
+ (#{Project.reference_pattern})?
+ #{Regexp.escape(reference_prefix)}(?<issue>\d+)
+ )
}x
end
+ def self.link_reference_pattern
+ super("issues", /(?<issue>\d+)/)
+ end
+
def to_reference(from_project = nil)
reference = "#{self.class.reference_prefix}#{iid}"