diff options
Diffstat (limited to 'app/services/suggestions/create_service.rb')
-rw-r--r-- | app/services/suggestions/create_service.rb | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/app/services/suggestions/create_service.rb b/app/services/suggestions/create_service.rb index 239cd86e0ec..d7c261f1c25 100644 --- a/app/services/suggestions/create_service.rb +++ b/app/services/suggestions/create_service.rb @@ -9,20 +9,22 @@ module Suggestions def execute return unless @note.supports_suggestion? - suggestions = Gitlab::Diff::SuggestionsParser.parse(@note.note, - project: @note.project, - position: @note.position) + suggestions = Gitlab::Diff::SuggestionsParser.parse( + @note.note, + project: @note.project, + position: @note.position + ) - rows = - suggestions.map.with_index do |suggestion, index| - creation_params = - suggestion.to_hash.slice(:from_content, - :to_content, - :lines_above, - :lines_below) + rows = suggestions.map.with_index do |suggestion, index| + creation_params = suggestion.to_hash.slice( + :from_content, + :to_content, + :lines_above, + :lines_below + ) - creation_params.merge!(note_id: @note.id, relative_order: index) - end + creation_params.merge!(note_id: @note.id, relative_order: index) + end rows.in_groups_of(100, false) do |rows| ApplicationRecord.legacy_bulk_insert('suggestions', rows) # rubocop:disable Gitlab/BulkInsert |