summaryrefslogtreecommitdiff
path: root/app/helpers/diff_helper.rb
diff options
context:
space:
mode:
authorPaco Guzman <pacoguzmanp@gmail.com>2016-07-15 09:04:18 +0200
committerDouwe Maan <douwe@selenight.nl>2016-07-18 14:43:28 -0600
commita404ab380db5959ab22b09bc586607b1f6c507cd (patch)
tree68cadd8516a1db0997dfa09e8fafd12b35391d78 /app/helpers/diff_helper.rb
parent65352b5baaf269a609b024fd13efc81e8bbdcefa (diff)
downloadgitlab-ce-a404ab380db5959ab22b09bc586607b1f6c507cd.tar.gz
Collapsed diffs lines/size don't accumulate to overflow diffs.19820-safer-diffs
Diffstat (limited to 'app/helpers/diff_helper.rb')
-rw-r--r--app/helpers/diff_helper.rb9
1 files changed, 5 insertions, 4 deletions
diff --git a/app/helpers/diff_helper.rb b/app/helpers/diff_helper.rb
index adab901700c..75b029365f9 100644
--- a/app/helpers/diff_helper.rb
+++ b/app/helpers/diff_helper.rb
@@ -9,7 +9,7 @@ module DiffHelper
end
def expand_all_diffs?
- @expand_all_diffs || params[:expand_all_diffs].present?
+ params[:expand_all_diffs].present?
end
def diff_view
@@ -23,13 +23,14 @@ module DiffHelper
end
def diff_options
- default_options = Commit.max_diff_options
+ options = { ignore_whitespace_change: hide_whitespace?, no_collapse: expand_all_diffs? }
if action_name == 'diff_for_path'
- default_options[:paths] = params.values_at(:old_path, :new_path)
+ options[:no_collapse] = true
+ options[:paths] = params.values_at(:old_path, :new_path)
end
- default_options.merge(ignore_whitespace_change: hide_whitespace?)
+ Commit.max_diff_options.merge(options)
end
def safe_diff_files(diffs, diff_refs: nil, repository: nil)