Welcome to mirror list, hosted at ThFree Co, Russian Federation.

blame_mode.rb « git « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d8fc8fece068fe0ea26c6d8ca7496498d1c26cc0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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