Fallback to default pattern when note does not belong to project

In commit 020295ff a regex was added to quickly determine if mentionables might
be referenced. But this didn't take into account the note might not belong to a
project. So when it doesn't belong to a project, assume the default issue
tracker is used, and use DEFAULT_PATTERN to check if there are mentionables.

Fixes gitlab-org/gitlab-ce#31993
This commit is contained in:
Toon Claes 2017-05-09 10:59:18 +02:00
parent 7ea12d8067
commit 69b10e1695
1 changed files with 1 additions and 1 deletions

View File

@ -92,7 +92,7 @@ module Mentionable
# Uses regex to quickly determine if mentionables might be referenced
# Allows heavy processing to be skipped
def matches_cross_reference_regex?
reference_pattern = if project.default_issues_tracker?
reference_pattern = if !project || project.default_issues_tracker?
ReferenceRegexes::DEFAULT_PATTERN
else
ReferenceRegexes::EXTERNAL_PATTERN