mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-26 20:56:48 +00:00
+ constraint the legacy checkout routes when `split_checkout` feature is disabled + add specs
21 lines
503 B
Ruby
21 lines
503 B
Ruby
# frozen_string_literal: true
|
|
|
|
module OpenFoodNetwork
|
|
# Feature toggles are configured via Flipper.
|
|
#
|
|
# - config/initializers/flipper.rb
|
|
# - http://localhost:3000/admin/feature-toggle/features
|
|
#
|
|
module FeatureToggle
|
|
def self.enabled?(feature_name, user = nil)
|
|
feature = Flipper.feature(feature_name)
|
|
feature.add unless feature.exist?
|
|
feature.enabled?(user)
|
|
end
|
|
|
|
def self.disabled?(feature_name, user = nil)
|
|
!enabled?(feature_name, user)
|
|
end
|
|
end
|
|
end
|