summaryrefslogtreecommitdiff
path: root/app/views/projects/diffs
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/views/projects/diffs
parent65352b5baaf269a609b024fd13efc81e8bbdcefa (diff)
downloadgitlab-ce-a404ab380db5959ab22b09bc586607b1f6c507cd.tar.gz
Collapsed diffs lines/size don't accumulate to overflow diffs.19820-safer-diffs
Diffstat (limited to 'app/views/projects/diffs')
-rw-r--r--app/views/projects/diffs/_content.html.haml10
-rw-r--r--app/views/projects/diffs/_diffs.html.haml2
2 files changed, 6 insertions, 6 deletions
diff --git a/app/views/projects/diffs/_content.html.haml b/app/views/projects/diffs/_content.html.haml
index 0c0424edffd..a1b071f130c 100644
--- a/app/views/projects/diffs/_content.html.haml
+++ b/app/views/projects/diffs/_content.html.haml
@@ -8,12 +8,12 @@
- elsif blob_text_viewable?(blob)
- if !project.repository.diffable?(blob)
.nothing-here-block This diff was suppressed by a .gitattributes entry.
+ - elsif diff_file.collapsed?
+ - url = url_for(params.merge(action: :diff_for_path, old_path: diff_file.old_path, new_path: diff_file.new_path))
+ .nothing-here-block.diff-collapsed{data: { diff_for_path: url } }
+ This diff is collapsed. Click to expand it.
- elsif diff_file.diff_lines.length > 0
- - if diff_file.collapsed_by_default? && !expand_all_diffs?
- - url = url_for(params.merge(action: :diff_for_path, old_path: diff_file.old_path, new_path: diff_file.new_path))
- .nothing-here-block.diff-collapsed{data: { diff_for_path: url } }
- This diff is collapsed. Click to expand it.
- - elsif diff_view == 'parallel'
+ - if diff_view == 'parallel'
= render "projects/diffs/parallel_view", diff_file: diff_file, project: project, blob: blob
- else
= render "projects/diffs/text_file", diff_file: diff_file
diff --git a/app/views/projects/diffs/_diffs.html.haml b/app/views/projects/diffs/_diffs.html.haml
index 20aaab5accf..8ae433b4823 100644
--- a/app/views/projects/diffs/_diffs.html.haml
+++ b/app/views/projects/diffs/_diffs.html.haml
@@ -6,7 +6,7 @@
.content-block.oneline-block.files-changed
.inline-parallel-buttons
- - unless expand_all_diffs?
+ - if !expand_all_diffs? && diff_files.any? { |diff_file| diff_file.collapsed? }
= link_to 'Expand all', url_for(params.merge(expand_all_diffs: 1, format: 'html')), class: 'btn btn-default'
- if show_whitespace_toggle
- if current_controller?(:commit)