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