debian-mirror-gitlab/lib/gitlab/sourcegraph.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

29 lines
760 B
Ruby
Raw Normal View History

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