2015-02-02 23:11:19 +00:00
|
|
|
class ExternalIssue
|
2015-05-03 03:11:21 +00:00
|
|
|
include Referable
|
|
|
|
|
2015-02-02 23:11:19 +00:00
|
|
|
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
|
|
|
|
|
2015-04-30 21:27:33 +00:00
|
|
|
def title
|
|
|
|
"External Issue #{self}"
|
|
|
|
end
|
|
|
|
|
2015-02-02 23:11:19 +00:00
|
|
|
def ==(other)
|
|
|
|
other.is_a?(self.class) && (to_s == other.to_s)
|
|
|
|
end
|
2017-03-03 14:25:52 +00:00
|
|
|
alias_method :eql?, :==
|
|
|
|
|
|
|
|
def hash
|
|
|
|
[self.class, to_s].hash
|
|
|
|
end
|
2015-02-02 23:11:19 +00:00
|
|
|
|
|
|
|
def project
|
|
|
|
@project
|
|
|
|
end
|
2015-05-14 20:59:39 +00:00
|
|
|
|
2016-10-11 15:37:19 +00:00
|
|
|
def project_id
|
|
|
|
@project.id
|
|
|
|
end
|
|
|
|
|
2017-11-22 13:20:35 +00:00
|
|
|
def to_reference(_from = nil, full: nil)
|
2018-02-14 11:51:49 +00:00
|
|
|
reference_link_text
|
2015-05-14 20:59:39 +00:00
|
|
|
end
|
2016-03-22 09:56:44 +00:00
|
|
|
|
2017-11-22 13:20:35 +00:00
|
|
|
def reference_link_text(from = nil)
|
2017-02-22 00:16:48 +00:00
|
|
|
return "##{id}" if id =~ /^\d+$/
|
2016-04-12 08:01:52 +00:00
|
|
|
|
|
|
|
id
|
2016-03-22 09:56:44 +00:00
|
|
|
end
|
2017-11-07 16:11:37 +00:00
|
|
|
|
|
|
|
def notes
|
|
|
|
Note.none
|
|
|
|
end
|
2015-02-02 23:11:19 +00:00
|
|
|
end
|