gitlab-org--gitlab-foss/app/models/external_issue.rb
Sean McGivern a4bb0ff8b8 Fix closing issues text added to MRs for external issue trackers
Before, this would:

1. Not use the correct reference for non-JIRA external trackers.
2. Append 'Closes ' if an external tracker was enabled, but no issue matched the
   branch name.
2018-02-14 14:58:28 +00:00

54 lines
753 B
Ruby

class ExternalIssue
include Referable
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 title
"External Issue #{self}"
end
def ==(other)
other.is_a?(self.class) && (to_s == other.to_s)
end
alias_method :eql?, :==
def hash
[self.class, to_s].hash
end
def project
@project
end
def project_id
@project.id
end
def to_reference(_from = nil, full: nil)
reference_link_text
end
def reference_link_text(from = nil)
return "##{id}" if id =~ /^\d+$/
id
end
def notes
Note.none
end
end