Commit 78496e8c authored by Sean McGivern's avatar Sean McGivern

Disable overflow messages

With the option to expand and collapse individual diffs, these aren't
needed any more.
parent b6b26692
...@@ -37,16 +37,8 @@ module DiffHelper ...@@ -37,16 +37,8 @@ module DiffHelper
end end
end end
def diff_hard_limit_enabled?
params[:force_show_diff].present?
end
def diff_options def diff_options
options = { ignore_whitespace_change: hide_whitespace? } Commit.max_diff_options.merge(ignore_whitespace_change: hide_whitespace?)
if diff_hard_limit_enabled?
options.merge!(Commit.max_diff_options)
end
options
end end
def safe_diff_files(diffs, diff_refs: nil, repository: nil) def safe_diff_files(diffs, diff_refs: nil, repository: nil)
......
- too_big = diff_file.diff_lines.count > Commit::DIFF_SAFE_LINES %table.text-file.code.js-syntax-highlight
- if too_big
.suppressed-container
%a.show-suppressed-diff.js-show-suppressed-diff Changes suppressed. Click to show.
%table.text-file.code.js-syntax-highlight{ class: too_big ? 'hide' : '' }
- last_line = 0 - last_line = 0
- diff_file.highlighted_diff_lines.each do |line| - diff_file.highlighted_diff_lines.each do |line|
- last_line = line.new_pos - last_line = line.new_pos
......
...@@ -2,9 +2,6 @@ ...@@ -2,9 +2,6 @@
%h4 %h4
Too many changes to show. Too many changes to show.
.pull-right .pull-right
- unless diff_hard_limit_enabled?
= link_to "Reload with full diff", url_for(params.merge(force_show_diff: true, format: nil)), class: "btn btn-sm"
- if current_controller?(:commit) or current_controller?(:merge_requests) - if current_controller?(:commit) or current_controller?(:merge_requests)
- if current_controller?(:commit) - if current_controller?(:commit)
= link_to "Plain diff", namespace_project_commit_path(@project.namespace, @project, @commit, format: :diff), class: "btn btn-sm" = link_to "Plain diff", namespace_project_commit_path(@project.namespace, @project, @commit, format: :diff), class: "btn btn-sm"
......
...@@ -83,11 +83,6 @@ Feature: Project Commits ...@@ -83,11 +83,6 @@ Feature: Project Commits
#Given I visit my project's commits stats page #Given I visit my project's commits stats page
#Then I see commits stats #Then I see commits stats
Scenario: I browse big commit
Given I visit big commit page
Then I see big commit warning
And I see "Reload with full diff" link
Scenario: I browse a commit with an image Scenario: I browse a commit with an image
Given I visit a commit with an image that changed Given I visit a commit with an image that changed
Then The diff links to both the previous and current image Then The diff links to both the previous and current image
......
...@@ -125,25 +125,6 @@ class Spinach::Features::ProjectCommits < Spinach::FeatureSteps ...@@ -125,25 +125,6 @@ class Spinach::Features::ProjectCommits < Spinach::FeatureSteps
expect(page).to have_content 'Authors' expect(page).to have_content 'Authors'
end end
step 'I visit big commit page' do
# Create a temporary scope to ensure that the stub_const is removed after user
RSpec::Mocks.with_temporary_scope do
stub_const('Gitlab::Git::DiffCollection::DEFAULT_LIMITS', { max_lines: 1, max_files: 1 })
visit namespace_project_commit_path(@project.namespace, @project, sample_big_commit.id)
end
end
step 'I see big commit warning' do
expect(page).to have_content sample_big_commit.message
expect(page).to have_content "Too many changes"
end
step 'I see "Reload with full diff" link' do
link = find_link('Reload with full diff')
expect(link[:href]).to end_with('?force_show_diff=true')
expect(link[:href]).not_to include('.html')
end
step 'I visit a commit with an image that changed' do step 'I visit a commit with an image that changed' do
visit namespace_project_commit_path(@project.namespace, @project, sample_image_commit.id) visit namespace_project_commit_path(@project.namespace, @project, sample_image_commit.id)
end end
......
...@@ -31,26 +31,11 @@ describe DiffHelper do ...@@ -31,26 +31,11 @@ describe DiffHelper do
end end
end end
describe 'diff_hard_limit_enabled?' do
it 'should return true if param is provided' do
allow(controller).to receive(:params) { { force_show_diff: true } }
expect(diff_hard_limit_enabled?).to be_truthy
end
it 'should return false if param is not provided' do
expect(diff_hard_limit_enabled?).to be_falsey
end
end
describe 'diff_options' do describe 'diff_options' do
it 'should return hard limit for a diff if force diff is true' do it 'should return hard limit for a diff' do
allow(controller).to receive(:params) { { force_show_diff: true } } allow(controller).to receive(:params) { { force_show_diff: true } }
expect(diff_options).to include(Commit.max_diff_options) expect(diff_options).to include(Commit.max_diff_options)
end end
it 'should return safe limit for a diff if force diff is false' do
expect(diff_options).not_to include(:max_lines, :max_files)
end
end end
describe 'unfold_bottom_class' do describe 'unfold_bottom_class' do
......
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