From 71a5e41e5b8efe5f9920c0925291bf5018978812 Mon Sep 17 00:00:00 2001 From: Christophe Robillard Date: Tue, 30 Mar 2021 10:56:29 +0200 Subject: [PATCH] add archive_zip_globale feature flag --- app/controllers/instructeurs/archives_controller.rb | 2 +- .../instructeurs/procedures/_download_dossiers.html.haml | 5 +++-- spec/controllers/instructeurs/archives_controller_spec.rb | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/controllers/instructeurs/archives_controller.rb b/app/controllers/instructeurs/archives_controller.rb index 308f51b80..d4e7400d7 100644 --- a/app/controllers/instructeurs/archives_controller.rb +++ b/app/controllers/instructeurs/archives_controller.rb @@ -23,7 +23,7 @@ module Instructeurs private def ensure_procedure_enabled - if !procedure.publiee? + if !procedure.feature_enabled?(:archive_zip_globale) || !procedure.publiee? flash[:alert] = "L'accès aux archives n'est pas disponible pour cette démarche, merci d'en faire la demande à l'équipe de démarches simplifiees" return redirect_to instructeur_procedure_path(procedure) end diff --git a/app/views/instructeurs/procedures/_download_dossiers.html.haml b/app/views/instructeurs/procedures/_download_dossiers.html.haml index 1e0993605..b6e5dedf6 100644 --- a/app/views/instructeurs/procedures/_download_dossiers.html.haml +++ b/app/views/instructeurs/procedures/_download_dossiers.html.haml @@ -16,5 +16,6 @@ - else %span{ 'data-export-poll-url': download_export_instructeur_procedure_path(procedure, export_format: format, no_progress_notification: true) } = t(:export_pending_html, export_time: time_ago_in_words(export.created_at), export_format: ".#{format}", scope: [:instructeurs, :procedure]) - %li - = link_to t(:download_archive, scope: [:instructeurs, :procedure]), instructeur_archives_path(procedure) + - if procedure.feature_enabled?(:archive_zip_globale) + %li + = link_to t(:download_archive, scope: [:instructeurs, :procedure]), instructeur_archives_path(procedure) diff --git a/spec/controllers/instructeurs/archives_controller_spec.rb b/spec/controllers/instructeurs/archives_controller_spec.rb index d698c95bb..7229f5720 100644 --- a/spec/controllers/instructeurs/archives_controller_spec.rb +++ b/spec/controllers/instructeurs/archives_controller_spec.rb @@ -9,6 +9,7 @@ describe Instructeurs::ArchivesController, type: :controller do before do sign_in(instructeur.user) + Flipper.enable(:archive_zip_globale, procedure1) end after { Timecop.return }