Commit f19bf0ea authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre
Browse files

Import comments on the diff of a GitHub Pull Request into GitLab

parent 223f7f53
......@@ -81,6 +81,18 @@ def import_pull_requests
updated_at: c.updated_at
)
end
client.pull_request_comments(project.import_source, pull_request.number).each do |c|
merge_request.notes.create!(
project: project,
note: format_body(c.user.login, c.body),
commit_id: c.commit_id,
line_code: generate_line_code(c.path, c.position),
author_id: gl_author_id(project, c.user.id),
created_at: c.created_at,
updated_at: c.updated_at
)
end
end
end
......@@ -99,6 +111,10 @@ def merge_request_state(pull_request)
end
end
def generate_line_code(file_path, position)
Gitlab::Diff::LineCode.generate(file_path, position, 0)
end
def gl_author_id(project, github_id)
gl_user_id(github_id) || project.creator_id
end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment