Cleanup feature flags usage
This commit is contained in:
parent
46377fb7d9
commit
1c811083c0
9 changed files with 20 additions and 18 deletions
|
@ -67,10 +67,6 @@ class ApplicationController < ActionController::Base
|
|||
Flipper.enabled?(feature_name, current_user)
|
||||
end
|
||||
|
||||
def feature_enabled_for?(feature_name, item)
|
||||
Flipper.enabled?(feature_name, item)
|
||||
end
|
||||
|
||||
def authenticate_logged_user!
|
||||
if instructeur_signed_in?
|
||||
authenticate_instructeur!
|
||||
|
|
|
@ -72,7 +72,7 @@ module Instructeurs
|
|||
|
||||
def create_avis
|
||||
@procedure = Procedure.find(params[:procedure_id])
|
||||
if !feature_enabled_for?(:expert_not_allowed_to_invite, @procedure)
|
||||
if !@procedure.feature_enabled?(:expert_not_allowed_to_invite)
|
||||
@new_avis = create_avis_from_params(avis.dossier, avis.confidentiel)
|
||||
|
||||
if @new_avis.nil?
|
||||
|
|
|
@ -2,8 +2,4 @@ module FlipperHelper
|
|||
def feature_enabled?(feature_name)
|
||||
Flipper.enabled?(feature_name, current_user)
|
||||
end
|
||||
|
||||
def feature_enabled_for?(feature_name, item)
|
||||
Flipper.enabled?(feature_name, item)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -342,6 +342,10 @@ class Procedure < ApplicationRecord
|
|||
end
|
||||
end
|
||||
|
||||
def feature_enabled?(feature)
|
||||
Flipper.enabled?(feature, self)
|
||||
end
|
||||
|
||||
# Warning: dossier after_save build_default_champs must be removed
|
||||
# to save a dossier created from this method
|
||||
def new_dossier
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
= link_to 'Voir mes dossiers en cours', dossiers_path, class: ['button large expand primary']
|
||||
= link_to 'Commencer un nouveau dossier', url_for_new_dossier(@procedure), class: ['button large expand']
|
||||
|
||||
- if feature_enabled_for?(:dossier_pdf_vide, @procedure)
|
||||
- if @procedure.feature_enabled?(:dossier_pdf_vide)
|
||||
- pdf_link = commencer_dossier_vide_path(path: @procedure.path)
|
||||
- if @procedure.brouillon?
|
||||
- pdf_link = commencer_dossier_vide_test_path(path: @procedure.path)
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
.send-wrapper
|
||||
= f.submit 'Envoyer votre avis', class: 'button send'
|
||||
|
||||
- if !@dossier.termine? && !feature_enabled_for?(:expert_not_allowed_to_invite, @avis.procedure)
|
||||
- if !@dossier.termine? && !@avis.procedure.feature_enabled?(:expert_not_allowed_to_invite)
|
||||
= render partial: "instructeurs/shared/avis/form", locals: { url: avis_instructeur_avis_path(@avis.procedure, @avis), linked_dossiers: @dossier.linked_dossiers_for(current_instructeur), must_be_confidentiel: @avis.confidentiel?, avis: @new_avis }
|
||||
|
||||
- if @dossier.avis_for(current_instructeur).present?
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
|
||||
-# only display the coronavirus to usagers (instructeurs know there are delays) when they are logged in, or on the public pages.
|
||||
- if user_signed_in?
|
||||
- if dossier.present? && feature_enabled_for?(:coronavirus_banner, dossier.procedure)
|
||||
- if dossier.present? && dossier.procedure.feature_enabled?(:coronavirus_banner)
|
||||
= render partial: 'layouts/coronavirus_banner'
|
||||
- else
|
||||
- if procedure.present? && feature_enabled_for?(:coronavirus_banner, procedure)
|
||||
- if procedure.present? && procedure.feature_enabled?(:coronavirus_banner)
|
||||
= render partial: 'layouts/coronavirus_banner'
|
||||
|
||||
%header.new-header{ class: current_page?(root_path) ? nil : "new-header-with-border", role: 'banner' }
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
%thead
|
||||
%tr
|
||||
%th Liste des experts
|
||||
- if feature_enabled_for?(:make_experts_notifiable, @procedure)
|
||||
- if @procedure.feature_enabled?(:make_experts_notifiable)
|
||||
%th Notifier des décisions sur les dossiers
|
||||
%tbody
|
||||
- @experts_procedure.each do |expert_procedure|
|
||||
|
@ -18,7 +18,7 @@
|
|||
%td
|
||||
%span.icon.person
|
||||
= expert_procedure.expert.email
|
||||
- if feature_enabled_for?(:make_experts_notifiable, @procedure)
|
||||
- if @procedure.feature_enabled?(:make_experts_notifiable)
|
||||
%td
|
||||
= form_for expert_procedure,
|
||||
url: admin_procedure_update_allow_decision_access_path(expert_procedure: expert_procedure),
|
||||
|
|
|
@ -25,14 +25,20 @@ end
|
|||
|
||||
# A list of features to be deployed on first push
|
||||
features = [
|
||||
:administrateur_routage,
|
||||
:administrateur_web_hook,
|
||||
:carte_ign,
|
||||
:coronavirus_banner,
|
||||
:dossier_pdf_vide,
|
||||
:expert_not_allowed_to_invite,
|
||||
:hide_instructeur_email,
|
||||
:insee_api_v3,
|
||||
:instructeur_bypass_email_login_token,
|
||||
:localization,
|
||||
:maintenance_mode,
|
||||
:make_experts_notifiable,
|
||||
:mini_profiler,
|
||||
:xray,
|
||||
:carte_ign,
|
||||
:localization
|
||||
:xray
|
||||
]
|
||||
|
||||
def database_exists?
|
||||
|
|
Loading…
Reference in a new issue