issue_formatter.rb 720 Bytes
Newer Older
1 2
# frozen_string_literal: true

3
module Gitlab
4
  module LegacyGithubImport
5
    class IssueFormatter < IssuableFormatter
6 7
      def attributes
        {
8
          iid: number,
9
          project: project,
10
          milestone: milestone,
11 12 13 14
          title: raw_data.title,
          description: description,
          state: state,
          author_id: author_id,
15
          assignee_ids: Array(assignee_id),
16
          created_at: raw_data.created_at,
17
          updated_at: raw_data.updated_at
18 19 20 21 22 23 24
        }
      end

      def has_comments?
        raw_data.comments > 0
      end

25 26 27 28
      def project_association
        :issues
      end

29 30
      def pull_request?
        raw_data.pull_request.present?
31 32 33 34
      end
    end
  end
end