Commit 5817c670 authored by Stan Hu's avatar Stan Hu

Import threaded discussions in diffs

parent ea727862
......@@ -135,7 +135,23 @@ module Gitlab
end
inline_comments.each do |comment|
begin
parent = build_diff_note(merge_request, comment, line_code_map)
next unless parent&.persisted?
comment.comments.each do |reply|
attributes = pull_request_comment_attributes(reply)
attributes.merge!(
position: build_position(merge_request, comment),
line_code: line_code_map.fetch(reply.id)
discussion_id: parent.discussion_id,
type: 'DiffNote')
merge_request.notes.create!(attributes)
end
end
end
def build_diff_note(merge_request, comment, line_code_map)
attributes = pull_request_comment_attributes(comment)
attributes.merge!(
position: build_position(merge_request, comment),
......@@ -145,8 +161,7 @@ module Gitlab
merge_request.notes.create!(attributes)
rescue StandardError => e
errors << { type: :pull_request, id: comment.id, errors: e.message }
end
end
nil
end
def build_position(merge_request, pr_comment)
......
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