Class: Gitlab::LegacyGithubImport::IssueFormatter

Inherits:
IssuableFormatter show all
Defined in:
lib/gitlab/legacy_github_import/issue_formatter.rb

Constant Summary

Constants included from Import::UsernameMentionRewriter

Import::UsernameMentionRewriter::MENTION_REGEX

Instance Attribute Summary

Attributes inherited from BaseFormatter

#client, #formatter, #project, #raw_data, #source_user_mapper

Instance Method Summary collapse

Methods inherited from IssuableFormatter

#create!, #find_condition, #number

Methods included from Import::UsernameMentionRewriter

#update_username_mentions, #wrap_mentions_in_backticks

Methods inherited from BaseFormatter

#create!, #create_record, #imported_from, #initialize, #push_placeholder_reference, #push_placeholder_references, #url

Constructor Details

This class inherits a constructor from Gitlab::LegacyGithubImport::BaseFormatter

Instance Method Details

#attributesObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/gitlab/legacy_github_import/issue_formatter.rb', line 6

def attributes
  {
    iid: number,
    project: project,
    milestone: milestone,
    title: raw_data[:title],
    description: description,
    state: state,
    author_id: author_id,
    assignee_ids: Array(assignee_id),
    created_at: raw_data[:created_at],
    updated_at: raw_data[:updated_at],
    imported_from: imported_from
  }
end

#contributing_assignee_formattersObject



44
45
46
47
48
# File 'lib/gitlab/legacy_github_import/issue_formatter.rb', line 44

def contributing_assignee_formatters
  {
    user_id: assignee
  }
end

#contributing_user_formattersObject



38
39
40
41
42
# File 'lib/gitlab/legacy_github_import/issue_formatter.rb', line 38

def contributing_user_formatters
  {
    author_id: author
  }
end

#has_comments?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/gitlab/legacy_github_import/issue_formatter.rb', line 22

def has_comments?
  raw_data[:comments] > 0
end

#project_assignee_associationObject



34
35
36
# File 'lib/gitlab/legacy_github_import/issue_formatter.rb', line 34

def project_assignee_association
  :issue_assignees
end

#project_associationObject



26
27
28
# File 'lib/gitlab/legacy_github_import/issue_formatter.rb', line 26

def project_association
  :issues
end

#pull_request?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/gitlab/legacy_github_import/issue_formatter.rb', line 30

def pull_request?
  raw_data[:pull_request].present?
end