From 155c362662853556a8efba7969ac2222f21cadc8 Mon Sep 17 00:00:00 2001 From: Christopher Guess Date: Fri, 29 Mar 2024 10:15:07 -0400 Subject: [PATCH] Add feature flag for adhoc --- Gemfile | 4 ++++ Gemfile.lock | 7 ++++++ .../media_vault/archive_controller.rb | 2 +- .../layouts/media_vault/_header.html.erb | 2 +- app/views/media_vault/archive/index.html.erb | 2 ++ .../20240329133544_create_flipper_tables.rb | 22 +++++++++++++++++++ db/schema.rb | 18 ++++++++++++++- 7 files changed, 54 insertions(+), 3 deletions(-) create mode 100644 db/migrate/20240329133544_create_flipper_tables.rb diff --git a/Gemfile b/Gemfile index d949eaf3..c348fe04 100644 --- a/Gemfile +++ b/Gemfile @@ -232,3 +232,7 @@ gem "mechanize" # Better logging printing gem "amazing_print" # gem "rails_semantic_logger" + +gem "flipper", "~> 1.2" + +gem "flipper-active_record", "~> 1.2" diff --git a/Gemfile.lock b/Gemfile.lock index 5e527422..f2fa5715 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -256,6 +256,11 @@ GEM ffi (1.16.3) figaro (1.2.0) thor (>= 0.14.0, < 2) + flipper (1.2.2) + concurrent-ruby (< 2) + flipper-active_record (1.2.2) + activerecord (>= 4.2, < 8) + flipper (~> 1.2.2) globalid (1.1.0) activesupport (>= 5.0) hana (1.3.7) @@ -678,6 +683,8 @@ DEPENDENCIES eikon ferrum (~> 0.11) figaro + flipper (~> 1.2) + flipper-active_record (~> 1.2) forki! hiredis honeybadger (~> 5.2) diff --git a/app/controllers/media_vault/archive_controller.rb b/app/controllers/media_vault/archive_controller.rb index c2ebb892..ac09ea85 100644 --- a/app/controllers/media_vault/archive_controller.rb +++ b/app/controllers/media_vault/archive_controller.rb @@ -21,7 +21,7 @@ def index end # Here we need to see if we're on a personal archive page, and limit if so to the one's this person owns. - if params[:myvault].present? + if params[:myvault].present? && Flipper.enabled?(:adhoc, current_user) archive_items = current_user.archive_items @myvault = true else diff --git a/app/views/layouts/media_vault/_header.html.erb b/app/views/layouts/media_vault/_header.html.erb index 73e81197..eb743e82 100644 --- a/app/views/layouts/media_vault/_header.html.erb +++ b/app/views/layouts/media_vault/_header.html.erb @@ -19,7 +19,7 @@