Class: Gitlab::GithubImport::Importer::PullRequests::ReviewImporter

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/github_import/importer/pull_requests/review_importer.rb

Instance Method Summary collapse

Constructor Details

#initialize(review, project, client) ⇒ ReviewImporter

review - An instance of ‘Gitlab::GithubImport::Representation::PullRequestReview` project - An instance of `Project` client - An instance of `Gitlab::GithubImport::Client`



11
12
13
14
15
16
# File 'lib/gitlab/github_import/importer/pull_requests/review_importer.rb', line 11

def initialize(review, project, client)
  @review = review
  @project = project
  @client = client
  @merge_request = project.merge_requests.find_by_id(review.merge_request_id)
end

Instance Method Details

#executeObject



18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/gitlab/github_import/importer/pull_requests/review_importer.rb', line 18

def execute
  user_finder = GithubImport::UserFinder.new(project, client)

  gitlab_user_id = user_finder.user_id_for(review.author)

  if gitlab_user_id
    add_review_note!(gitlab_user_id)
    add_approval!(gitlab_user_id)
    add_reviewer!(gitlab_user_id)
  else
    add_complementary_review_note!(project.creator_id)
  end
end