gitlab-org--gitlab-foss/app/models/external_issue.rb

56 lines
777 B
Ruby
Raw Normal View History

# frozen_string_literal: true
class ExternalIssue
include Referable
attr_reader :project
def initialize(issue_identifier, project)
@issue_identifier = issue_identifier
@project = project
end
def to_s
@issue_identifier.to_s
end
def id
@issue_identifier.to_s
end
def iid
@issue_identifier.to_s
end
2015-04-30 17:27:33 -04:00
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_id
project.id
end
2017-11-22 08:20:35 -05:00
def to_reference(_from = nil, full: nil)
reference_link_text
end
2017-11-22 08:20:35 -05:00
def reference_link_text(from = nil)
2017-02-21 19:16:48 -05:00
return "##{id}" if id =~ /^\d+$/
id
end
def notes
Note.none
end
end