summaryrefslogtreecommitdiff
path: root/app/helpers/diff_helper.rb
blob: ee4d4fbdff56424cf9a8330fdd4104d54848faa6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
module DiffHelper
  def safe_diff_files(diffs)
    if diff_hard_limit_enabled?
      diffs.first(Commit::DIFF_HARD_LIMIT_FILES)
    else
      diffs.first(Commit::DIFF_SAFE_FILES)
    end
  end

  def show_diff_size_warninig?(diffs)
    safe_diff_files(diffs).size < diffs.size
  end

  def diff_hard_limit_enabled?
    # Enabling hard limit allows user to see more diff information
    if params[:force_show_diff].present?
      true
    else
      false
    end
  end
end