Commit 44275e5066c36da3295f46971385db0e81ca1288

Authored by Dmitriy Zaporozhets
1 parent 432df031

Fix huge MR exceptions. Fixed link to diff for it

app/models/merge_request.rb
@@ -214,9 +214,9 @@ class MergeRequest < ActiveRecord::Base @@ -214,9 +214,9 @@ class MergeRequest < ActiveRecord::Base
214 end 214 end
215 215
216 def dump_diffs(diffs) 216 def dump_diffs(diffs)
217 - if broken_diffs? 217 + if diffs == broken_diffs
218 broken_diffs 218 broken_diffs
219 - else 219 + elsif diffs.respond_to?(:map)
220 diffs.map(&:to_hash) 220 diffs.map(&:to_hash)
221 end 221 end
222 end 222 end
@@ -224,7 +224,7 @@ class MergeRequest < ActiveRecord::Base @@ -224,7 +224,7 @@ class MergeRequest < ActiveRecord::Base
224 def load_diffs(raw) 224 def load_diffs(raw)
225 if raw == broken_diffs 225 if raw == broken_diffs
226 broken_diffs 226 broken_diffs
227 - else 227 + elsif raw.respond_to?(:map)
228 raw.map { |hash| Gitlab::Git::Diff.new(hash) } 228 raw.map { |hash| Gitlab::Git::Diff.new(hash) }
229 end 229 end
230 end 230 end
app/views/merge_requests/show/_diffs.html.haml
@@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
4 %h4.nothing_here_message 4 %h4.nothing_here_message
5 Can't load diff. 5 Can't load diff.
6 You can 6 You can
7 - = link_to "download it", project_merge_request_path(@project, @merge_request), format: :diff, class: "vlink" 7 + = link_to "download it", project_merge_request_path(@project, @merge_request, format: :diff), class: "vlink"
8 instead. 8 instead.
9 - else 9 - else
10 %h4.nothing_here_message Nothing to merge 10 %h4.nothing_here_message Nothing to merge