debian-mirror-gitlab/app/models/external_issue.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

56 lines
777 B
Ruby
Raw Normal View History

2018-11-18 11:00:15 +05:30
# frozen_string_literal: true
2015-04-26 12:48:37 +05:30
class ExternalIssue
2015-09-11 14:41:01 +05:30
include Referable
2019-03-02 22:35:43 +05:30
attr_reader :project
2015-04-26 12:48:37 +05:30
def initialize(issue_identifier, project)
2021-04-29 21:17:54 +05:30
@issue_identifier = issue_identifier
@project = project
2015-04-26 12:48:37 +05:30
end
def to_s
@issue_identifier.to_s
end
def id
@issue_identifier.to_s
end
def iid
@issue_identifier.to_s
end
2015-09-11 14:41:01 +05:30
def title
"External Issue #{self}"
end
2015-04-26 12:48:37 +05:30
def ==(other)
other.is_a?(self.class) && (to_s == other.to_s)
end
2017-08-17 22:00:37 +05:30
alias_method :eql?, :==
def hash
[self.class, to_s].hash
end
2015-04-26 12:48:37 +05:30
2017-08-17 22:00:37 +05:30
def project_id
2019-03-02 22:35:43 +05:30
project.id
2017-08-17 22:00:37 +05:30
end
2018-03-17 18:26:18 +05:30
def to_reference(_from = nil, full: nil)
reference_link_text
2015-09-11 14:41:01 +05:30
end
2016-06-02 11:05:42 +05:30
2018-03-17 18:26:18 +05:30
def reference_link_text(from = nil)
2017-08-17 22:00:37 +05:30
return "##{id}" if id =~ /^\d+$/
2016-06-02 11:05:42 +05:30
id
end
2018-03-17 18:26:18 +05:30
def notes
Note.none
end
2015-04-26 12:48:37 +05:30
end