Commit 5fdcaadf authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

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
parents 273093a9 59e18195
...@@ -90,6 +90,9 @@ class Projects::MergeRequestsController < Projects::ApplicationController ...@@ -90,6 +90,9 @@ class Projects::MergeRequestsController < Projects::ApplicationController
@merge_request.title = @merge_request.source_branch.titleize.humanize @merge_request.title = @merge_request.source_branch.titleize.humanize
@target_project = @merge_request.target_project @target_project = @merge_request.target_project
@target_repo = @target_project.repository @target_repo = @target_project.repository
diff_line_count = Commit::diff_line_count(@diffs)
@suppress_diff = Commit::diff_suppress?(@diffs, diff_line_count)
end end
end end
......
...@@ -6,12 +6,13 @@ ...@@ -6,12 +6,13 @@
%p %p
To preserve performance the diff is not shown. To preserve performance the diff is not shown.
- if current_controller?(:commit) or current_controller?(:merge_requests) - if current_controller?(:commit) or current_controller?(:merge_requests)
Please, download the diff as
- if current_controller?(:commit) - if current_controller?(:commit)
Please, download the diff as
= link_to "plain diff", project_commit_path(@project, @commit, format: :diff), class: "underlined-link" = link_to "plain diff", project_commit_path(@project, @commit, format: :diff), class: "underlined-link"
or or
= link_to "email patch", project_commit_path(@project, @commit, format: :patch), class: "underlined-link" = link_to "email patch", project_commit_path(@project, @commit, format: :patch), class: "underlined-link"
- else - elsif @merge_request && @merge_request.persisted?
Please, download the diff as
= link_to "plain diff", project_merge_request_path(@project, @merge_request, format: :diff), class: "underlined-link" = link_to "plain diff", project_merge_request_path(@project, @merge_request, format: :diff), class: "underlined-link"
or or
= link_to "email patch", project_merge_request_path(@project, @merge_request, format: :patch), class: "underlined-link" = link_to "email patch", project_merge_request_path(@project, @merge_request, format: :patch), class: "underlined-link"
......
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