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

sourcegraph.rb « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 8369e6fbe9b17a7725e317fa96006b4eee10ad5a (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
# frozen_string_literal: true

module Gitlab
  class Sourcegraph
    class << self
      def feature_conditional?
        feature.conditional?
      end

      def feature_available?
        # The sourcegraph feature could be conditionally applied, so check if `!off?`
        # We also can't just check !off? because the ActiveRecord might not exist yet
        self.feature_enabled? || !feature.off?
      end

      def feature_enabled?(actor = nil)
        # Some CI jobs grep for Feature.enabled? in our codebase, so it is important this reference stays around.
        Feature.enabled?(:sourcegraph, actor)
      end

      private

      def feature
        Feature.get(:sourcegraph) # rubocop:disable Gitlab/AvoidFeatureGet
      end
    end
  end
end