Commit bb060393 authored by Stan Hu's avatar Stan Hu

Some formatting cleanup

parent c16cbed9
...@@ -230,9 +230,7 @@ module Gitlab ...@@ -230,9 +230,7 @@ module Gitlab
def create_diff_note(merge_request, comment, position, discussion_id = nil) def create_diff_note(merge_request, comment, position, discussion_id = nil)
attributes = pull_request_comment_attributes(comment) attributes = pull_request_comment_attributes(comment)
attributes.merge!( attributes.merge!(position: position, type: 'DiffNote')
position: position,
type: 'DiffNote')
attributes[:discussion_id] = discussion_id if discussion_id attributes[:discussion_id] = discussion_id if discussion_id
note = merge_request.notes.build(attributes) note = merge_request.notes.build(attributes)
...@@ -242,16 +240,15 @@ module Gitlab ...@@ -242,16 +240,15 @@ module Gitlab
return note return note
end end
# Fallback to a regular comment # Bitbucket Server supports the ability to comment on any line, not just the
# line in the diff. If we can't add the note as a DiffNote, fallback to creating
# a regular note.
create_fallback_diff_note(merge_request, comment) create_fallback_diff_note(merge_request, comment)
rescue StandardError => e rescue StandardError => e
errors << { type: :pull_request, id: comment.id, errors: e.message } errors << { type: :pull_request, id: comment.id, errors: e.message }
nil nil
end end
# Bitbucket Server supports the ability to comment on any line, not just the
# line in the diff. If we can't add the note as a DiffNote, fallback to creating
# a regular note.
def create_fallback_diff_note(merge_request, comment) def create_fallback_diff_note(merge_request, comment)
attributes = pull_request_comment_attributes(comment) attributes = pull_request_comment_attributes(comment)
attributes[:note] = "Comment on file: #{comment.file_path}, old position: #{comment.old_pos}, new_position: #{comment.new_pos}\n\n" + attributes[:note] attributes[:note] = "Comment on file: #{comment.file_path}, old position: #{comment.old_pos}, new_position: #{comment.new_pos}\n\n" + attributes[:note]
......
...@@ -26,8 +26,7 @@ module Gitlab ...@@ -26,8 +26,7 @@ module Gitlab
import_url: repo.clone_url, import_url: repo.clone_url,
import_data: { import_data: {
credentials: session_data, credentials: session_data,
data: { project_key: project_key, data: { project_key: project_key, repo_slug: repo_slug }
repo_slug: repo_slug }
}, },
skip_wiki: true skip_wiki: true
).execute ).execute
......
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