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