Class: Gitlab::LegacyGithubImport::CommentFormatter

Inherits:
BaseFormatter
  • Object
show all
Includes:
Import::UsernameMentionRewriter
Defined in:
lib/gitlab/legacy_github_import/comment_formatter.rb

Constant Summary

Constants included from Import::UsernameMentionRewriter

Import::UsernameMentionRewriter::MENTION_REGEX

Instance Attribute Summary collapse

Attributes inherited from BaseFormatter

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

Instance Method Summary collapse

Methods included from Import::UsernameMentionRewriter

#update_username_mentions, #wrap_mentions_in_backticks

Methods inherited from BaseFormatter

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

Constructor Details

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

Instance Attribute Details

#author_id=(value) ⇒ Object

Sets the attribute author_id

Parameters:

  • value

    the value to set the attribute author_id to.



8
9
10
# File 'lib/gitlab/legacy_github_import/comment_formatter.rb', line 8

def author_id=(value)
  @author_id = value
end

#gitlab_issuableObject

Returns the value of attribute gitlab_issuable.



10
11
12
# File 'lib/gitlab/legacy_github_import/comment_formatter.rb', line 10

def gitlab_issuable
  @gitlab_issuable
end

Instance Method Details

#attributesObject



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/gitlab/legacy_github_import/comment_formatter.rb', line 12

def attributes
  {
    project: project,
    note: note,
    commit_id: raw_data[:commit_id],
    line_code: line_code,
    author_id: author_id,
    type: type,
    created_at: raw_data[:created_at],
    updated_at: raw_data[:updated_at],
    imported_from: imported_from
  }
end

#contributing_user_formattersObject



34
35
36
37
38
# File 'lib/gitlab/legacy_github_import/comment_formatter.rb', line 34

def contributing_user_formatters
  {
    author_id: author
  }
end

#create_recordObject



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

def create_record
  gitlab_issuable.notes.create!(attributes)
end

#project_associationObject



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

def project_association
  :notes
end