2019-11-15 18:06:24 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Gitlab
|
|
|
|
class Sourcegraph
|
|
|
|
class << self
|
|
|
|
def feature_conditional?
|
|
|
|
feature.conditional?
|
|
|
|
end
|
|
|
|
|
|
|
|
def feature_available?
|
2022-01-18 18:11:20 +00:00
|
|
|
# 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?
|
2019-11-15 18:06:24 +00:00
|
|
|
end
|
|
|
|
|
2020-09-16 18:09:47 +00:00
|
|
|
def feature_enabled?(actor = nil)
|
2020-12-18 00:10:04 +00:00
|
|
|
# Some CI jobs grep for Feature.enabled? in our codebase, so it is important this reference stays around.
|
2022-05-06 15:09:03 +00:00
|
|
|
Feature.enabled?(:sourcegraph, actor)
|
2019-11-15 18:06:24 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def feature
|
2020-06-02 12:08:33 +00:00
|
|
|
Feature.get(:sourcegraph) # rubocop:disable Gitlab/AvoidFeatureGet
|
2019-11-15 18:06:24 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|