Class: Gitlab::GithubImport::Importer::Events::CrossReferenced

Inherits:
BaseImporter
  • Object
show all
Defined in:
lib/gitlab/github_import/importer/events/cross_referenced.rb

Instance Method Summary collapse

Methods inherited from BaseImporter

#initialize

Methods included from PushPlaceholderReferences

#push_refs_with_ids, #push_with_composite_key, #push_with_record

Constructor Details

This class inherits a constructor from Gitlab::GithubImport::Importer::Events::BaseImporter

Instance Method Details

#execute(issue_event) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/gitlab/github_import/importer/events/cross_referenced.rb', line 8

def execute(issue_event)
  mentioned_in_record_class = mentioned_in_type(issue_event)
  mentioned_in_number = issue_event.source.dig(:issue, :number)
  mentioned_in_record = init_mentioned_in(
    mentioned_in_record_class, mentioned_in_number
  )
  return if mentioned_in_record.nil?

  user_id = author_id(issue_event)
  note_body = cross_reference_note_content(mentioned_in_record.gfm_reference(project))

  note = create_note(issue_event, note_body, user_id)

  track_activity(mentioned_in_record_class, note.author)
end