diff options
Diffstat (limited to 'app/helpers/diff_helper.rb')
-rw-r--r-- | app/helpers/diff_helper.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/app/helpers/diff_helper.rb b/app/helpers/diff_helper.rb new file mode 100644 index 00000000000..ee4d4fbdff5 --- /dev/null +++ b/app/helpers/diff_helper.rb @@ -0,0 +1,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 |