BigW Consortium Gitlab

external_issue.rb 719 Bytes
Newer Older
1
class ExternalIssue
2 3
  include Referable

4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
  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

20 21 22 23
  def title
    "External Issue #{self}"
  end

24 25 26
  def ==(other)
    other.is_a?(self.class) && (to_s == other.to_s)
  end
27 28 29 30 31
  alias_method :eql?, :==

  def hash
    [self.class, to_s].hash
  end
32 33 34 35

  def project
    @project
  end
36

37 38 39 40
  def project_id
    @project.id
  end

41
  def to_reference(_from_project = nil, full: nil)
42 43
    id
  end
44 45

  def reference_link_text(from_project = nil)
46
    return "##{id}" if id =~ /^\d+$/
47 48

    id
49
  end
50
end