summaryrefslogtreecommitdiff
path: root/app/helpers/diff_helper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/helpers/diff_helper.rb')
-rw-r--r--app/helpers/diff_helper.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/app/helpers/diff_helper.rb b/app/helpers/diff_helper.rb
index 7bf3cb6230b..e430b0f402b 100644
--- a/app/helpers/diff_helper.rb
+++ b/app/helpers/diff_helper.rb
@@ -23,14 +23,16 @@ module DiffHelper
end
end
+ def show_only_context_commits?
+ !!params[:only_context_commits] || @merge_request&.commits&.empty?
+ end
+
def diff_options
options = { ignore_whitespace_change: hide_whitespace?, expanded: diffs_expanded? }
if action_name == 'diff_for_path'
options[:expanded] = true
options[:paths] = params.values_at(:old_path, :new_path)
- elsif action_name == 'show'
- options[:include_context_commits] = true unless @project.context_commits_enabled?
end
options