diff options
Diffstat (limited to 'lib/gitlab/git/blame_mode.rb')
-rw-r--r-- | lib/gitlab/git/blame_mode.rb | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/lib/gitlab/git/blame_mode.rb b/lib/gitlab/git/blame_mode.rb new file mode 100644 index 00000000000..d8fc8fece06 --- /dev/null +++ b/lib/gitlab/git/blame_mode.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true + +module Gitlab + module Git + class BlameMode + def initialize(project, params) + @project = project + @params = params + end + + def streaming_supported? + Feature.enabled?(:blame_page_streaming, project) + end + + def streaming? + return false unless streaming_supported? + + Gitlab::Utils.to_boolean(params[:streaming], default: false) + end + + def pagination? + return false if streaming? + return false if Gitlab::Utils.to_boolean(params[:no_pagination], default: false) + + Feature.enabled?(:blame_page_pagination, project) + end + + def full? + !streaming? && !pagination? + end + + private + + attr_reader :project, :params + end + end +end |