Skip to content

Commit

Permalink
12911: remove admin_style_v3 toggle for prod and staging
Browse files Browse the repository at this point in the history
  • Loading branch information
chahmedejaz committed Oct 15, 2024
1 parent 2be3f7b commit 32d7292
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 945 deletions.
6 changes: 4 additions & 2 deletions config/routes/spree.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,10 @@
end
end

# duplicate old path for reference when admin_style_v3 enabled
resources :products_old, to: 'products#index', only: :index
if Rails.env.development?
# duplicate old path for reference when admin_style_v3 enabled
resources :products_old, to: 'products#index', only: :index
end

get '/variants/search', :to => "variants#search", :as => :search_variants

Expand Down
21 changes: 17 additions & 4 deletions lib/open_food_network/feature_toggle.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,19 @@ module OpenFoodNetwork
# - http://localhost:3000/admin/feature-toggle/features
#
module FeatureToggle
def self.conditional_features
features = {}
if Rails.env.development?
features.merge!({
"admin_style_v3" => <<~DESC,
Test the work-in-progress design updates.
DESC
});
end

features
end

# Please add your new feature here to appear in the Flipper UI.
# We way move this to a YAML file when it becomes too awkward.
# **WARNING:** Features not in this list will be removed.
Expand All @@ -22,9 +35,6 @@ module FeatureToggle
# Flipper.enable("dragon_mode")
#
CURRENT_FEATURES = {
"admin_style_v3" => <<~DESC,
Test the work-in-progress design updates.
DESC
"api_reports" => <<~DESC,
An API endpoint for reports at
<code>/api/v0/reports/:report_type(/:report_subtype)</code>
Expand All @@ -48,7 +58,7 @@ module FeatureToggle
Activated for a user.
The user (INRAE researcher) has access to anonymised sales.
DESC
}.freeze
}.merge(conditional_features).freeze;

# Features you would like to be enabled to start with.
ACTIVE_BY_DEFAULT = {
Expand All @@ -75,6 +85,9 @@ def self.setup!

# Checks weather a feature is enabled for any of the given actors.
def self.enabled?(feature_name, *actors)
# TODO: Need to remove these checks when we fully remove the toggle from development as well
# need this check as Flipper won't recognize 'admin_style_v3' as it is removed for server envs
return true if !Rails.env.development? && feature_name == :admin_style_v3
return Flipper.enabled?(feature_name) if actors.empty?

actors.any? do |actor|
Expand Down
Loading

0 comments on commit 32d7292

Please sign in to comment.