2018-07-25 05:30:33 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2015-02-02 18:11:19 -05:00
|
|
|
class ExternalIssue
|
2015-05-02 23:11:21 -04:00
|
|
|
include Referable
|
|
|
|
|
2019-01-16 00:48:12 -05:00
|
|
|
attr_reader :project
|
|
|
|
|
2015-02-02 18:11:19 -05:00
|
|
|
def initialize(issue_identifier, project)
|
2021-04-19 17:09:27 -04:00
|
|
|
@issue_identifier = issue_identifier
|
|
|
|
@project = project
|
2015-02-02 18:11:19 -05:00
|
|
|
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
|
|
|
|
2016-10-11 11:37:19 -04:00
|
|
|
def project_id
|
2019-01-16 00:48:12 -05:00
|
|
|
project.id
|
2016-10-11 11:37:19 -04:00
|
|
|
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
|