Commit 29e606de authored by Marin Jankovski's avatar Marin Jankovski

Add ExternalIssue base model to make issue referencing more robust for external issue trackers.

parent 2dfd2198
...@@ -67,9 +67,10 @@ module Mentionable ...@@ -67,9 +67,10 @@ module Mentionable
return [] if text.blank? return [] if text.blank?
ext = Gitlab::ReferenceExtractor.new ext = Gitlab::ReferenceExtractor.new
ext.analyze(text, p) ext.analyze(text, p)
(ext.issues_for +
ext.merge_requests_for + (ext.issues_for(p) +
ext.commits_for).uniq - [local_reference] ext.merge_requests_for(p) +
ext.commits_for(p)).uniq - [local_reference]
end end
# Create a cross-reference Note for each GFM reference to another Mentionable found in +mentionable_text+. # Create a cross-reference Note for each GFM reference to another Mentionable found in +mentionable_text+.
......
class ExternalIssue
def initialize(issue_identifier, project)
@issue_identifier, @project = issue_identifier, project
end
def to_s
@issue_identifier.to_s
end
def id
@issue_identifier.to_s
end
def iid
@issue_identifier.to_s
end
def ==(other)
other.is_a?(self.class) && (to_s == other.to_s)
end
def project
@project
end
end
...@@ -71,7 +71,7 @@ module Gitlab ...@@ -71,7 +71,7 @@ module Gitlab
if entry_project.nil? if entry_project.nil?
false false
else else
project.nil? || project.id == entry_project.id project.nil? || entry_project.default_issues_tracker?
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment