Commit 5fdcaadf347e41109f20a4dee733f5b51030feda
Exists in
spb-stable
and in
2 other branches
Merge branch 'fix-new-mr-502' into 'master'
Fix 502 error on new merge request page When diff is huge we try to render it that cause 502 error often. After this patch we apply soft limits to diffs. So if diff is huge - we doing show it Fixes #1323
Showing
2 changed files
with
6 additions
and
2 deletions
Show diff stats
app/controllers/projects/merge_requests_controller.rb
... | ... | @@ -90,6 +90,9 @@ class Projects::MergeRequestsController < Projects::ApplicationController |
90 | 90 | @merge_request.title = @merge_request.source_branch.titleize.humanize |
91 | 91 | @target_project = @merge_request.target_project |
92 | 92 | @target_repo = @target_project.repository |
93 | + | |
94 | + diff_line_count = Commit::diff_line_count(@diffs) | |
95 | + @suppress_diff = Commit::diff_suppress?(@diffs, diff_line_count) | |
93 | 96 | end |
94 | 97 | end |
95 | 98 | ... | ... |
app/views/projects/commits/_diffs.html.haml
... | ... | @@ -6,12 +6,13 @@ |
6 | 6 | %p |
7 | 7 | To preserve performance the diff is not shown. |
8 | 8 | - if current_controller?(:commit) or current_controller?(:merge_requests) |
9 | - Please, download the diff as | |
10 | 9 | - if current_controller?(:commit) |
10 | + Please, download the diff as | |
11 | 11 | = link_to "plain diff", project_commit_path(@project, @commit, format: :diff), class: "underlined-link" |
12 | 12 | or |
13 | 13 | = link_to "email patch", project_commit_path(@project, @commit, format: :patch), class: "underlined-link" |
14 | - - else | |
14 | + - elsif @merge_request && @merge_request.persisted? | |
15 | + Please, download the diff as | |
15 | 16 | = link_to "plain diff", project_merge_request_path(@project, @merge_request, format: :diff), class: "underlined-link" |
16 | 17 | or |
17 | 18 | = link_to "email patch", project_merge_request_path(@project, @merge_request, format: :patch), class: "underlined-link" | ... | ... |