diff options
author | Oswaldo Ferreira <oswaldo@gitlab.com> | 2018-12-04 11:15:19 -0200 |
---|---|---|
committer | Oswaldo Ferreira <oswaldo@gitlab.com> | 2018-12-04 13:13:22 -0200 |
commit | 89a676019cd580520e6c2ee696b15818d6ca954a (patch) | |
tree | 5013aeadf4db0913699ad87efe15159e82c3c5fc /app/controllers/projects/merge_requests/diffs_controller.rb | |
parent | e9e3820cf31eab7ea237a2c8bf24d370775c5a0b (diff) | |
download | gitlab-ce-89a676019cd580520e6c2ee696b15818d6ca954a.tar.gz |
Avoid 500's when serializing legacy diff notesosw-fix-grouping-by-file-path
Diffstat (limited to 'app/controllers/projects/merge_requests/diffs_controller.rb')
-rw-r--r-- | app/controllers/projects/merge_requests/diffs_controller.rb | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/app/controllers/projects/merge_requests/diffs_controller.rb b/app/controllers/projects/merge_requests/diffs_controller.rb index b3d77335c2a..ddffbb17ace 100644 --- a/app/controllers/projects/merge_requests/diffs_controller.rb +++ b/app/controllers/projects/merge_requests/diffs_controller.rb @@ -22,12 +22,9 @@ class Projects::MergeRequests::DiffsController < Projects::MergeRequests::Applic def render_diffs @environment = @merge_request.environments_for(current_user).last - notes_grouped_by_path = renderable_notes.group_by { |note| note.position.file_path } - @diffs.diff_files.each do |diff_file| - notes = notes_grouped_by_path.fetch(diff_file.file_path, []) - notes.each { |note| diff_file.unfold_diff_lines(note.position) } - end + note_positions = renderable_notes.map(&:position).compact + @diffs.unfold_diff_files(note_positions) @diffs.write_cache |