mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-26 01:33:22 +00:00
Fix: Check feature toggle for hub early
This commit is contained in:
@@ -4,10 +4,11 @@ module OpenFoodNetwork
|
||||
class ScopeVariantToHub
|
||||
def initialize(hub, variant_overrides = nil)
|
||||
@variant_overrides = variant_overrides || VariantOverride.indexed(hub)
|
||||
@inventory_enabled = OpenFoodNetwork::FeatureToggle.enabled?(:inventory, hub)
|
||||
end
|
||||
|
||||
def scope(variant)
|
||||
return unless OpenFoodNetwork::FeatureToggle.enabled?(:inventory, @hub)
|
||||
return unless @inventory_enabled
|
||||
|
||||
variant.extend(OpenFoodNetwork::ScopeVariantToHub::ScopeVariantToHub)
|
||||
variant.instance_variable_set :@variant_override, @variant_overrides[variant]
|
||||
|
||||
Reference in New Issue
Block a user