summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-12-01 15:51:27 +0100
committerDouwe Maan <douwe@gitlab.com>2015-12-01 15:53:32 +0100
commitf3ea06eb7f8bef748be0882cb0b4fb58deed8eef (patch)
tree42e9620a2ec0234ce20778ae40d781c2504254e8 /app/models
parent62c14ba2edf9ac4b4bb1e8c46c0c60f1b6574909 (diff)
downloadgitlab-ce-f3ea06eb7f8bef748be0882cb0b4fb58deed8eef.tar.gz
Autolink first so we don't pick up numeric anchors as issue references.
Diffstat (limited to 'app/models')
-rw-r--r--app/models/commit.rb7
-rw-r--r--app/models/commit_range.rb7
-rw-r--r--app/models/issue.rb7
-rw-r--r--app/models/merge_request.rb7
-rw-r--r--app/models/snippet.rb7
5 files changed, 10 insertions, 25 deletions
diff --git a/app/models/commit.rb b/app/models/commit.rb
index a5d041a49c8..c0998a45709 100644
--- a/app/models/commit.rb
+++ b/app/models/commit.rb
@@ -73,11 +73,8 @@ class Commit
# This pattern supports cross-project references.
def self.reference_pattern
%r{
- #{link_reference_pattern} |
- (?:
- (?:#{Project.reference_pattern}#{reference_prefix})?
- (?<commit>\h{6,40})
- )
+ (?:#{Project.reference_pattern}#{reference_prefix})?
+ (?<commit>\h{6,40})
}x
end
diff --git a/app/models/commit_range.rb b/app/models/commit_range.rb
index f786a749b8e..b8bf36b32ce 100644
--- a/app/models/commit_range.rb
+++ b/app/models/commit_range.rb
@@ -44,11 +44,8 @@ class CommitRange
# This pattern supports cross-project references.
def self.reference_pattern
%r{
- #{link_reference_pattern} |
- (?:
- (?:#{Project.reference_pattern}#{reference_prefix})?
- (?<commit_range>#{STRICT_PATTERN})
- )
+ (?:#{Project.reference_pattern}#{reference_prefix})?
+ (?<commit_range>#{STRICT_PATTERN})
}x
end
diff --git a/app/models/issue.rb b/app/models/issue.rb
index e62acfdfd91..187b6482b6c 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -64,11 +64,8 @@ class Issue < ActiveRecord::Base
# This pattern supports cross-project references.
def self.reference_pattern
%r{
- #{link_reference_pattern} |
- (?:
- (#{Project.reference_pattern})?
- #{Regexp.escape(reference_prefix)}(?<issue>\d+)
- )
+ (#{Project.reference_pattern})?
+ #{Regexp.escape(reference_prefix)}(?<issue>\d+)
}x
end
diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb
index c1d3874adee..2a4aee7e5d9 100644
--- a/app/models/merge_request.rb
+++ b/app/models/merge_request.rb
@@ -146,11 +146,8 @@ class MergeRequest < ActiveRecord::Base
# This pattern supports cross-project references.
def self.reference_pattern
%r{
- #{link_reference_pattern} |
- (?:
- (#{Project.reference_pattern})?
- #{Regexp.escape(reference_prefix)}(?<merge_request>\d+)
- )
+ (#{Project.reference_pattern})?
+ #{Regexp.escape(reference_prefix)}(?<merge_request>\d+)
}x
end
diff --git a/app/models/snippet.rb b/app/models/snippet.rb
index 8ec12ddf6ef..f876be7a4c8 100644
--- a/app/models/snippet.rb
+++ b/app/models/snippet.rb
@@ -60,11 +60,8 @@ class Snippet < ActiveRecord::Base
# This pattern supports cross-project references.
def self.reference_pattern
%r{
- #{link_reference_pattern} |
- (?:
- (#{Project.reference_pattern})?
- #{Regexp.escape(reference_prefix)}(?<snippet>\d+)
- )
+ (#{Project.reference_pattern})?
+ #{Regexp.escape(reference_prefix)}(?<snippet>\d+)
}x
end