chore(flipper): always use feature_enabled? helper

This commit is contained in:
Paul Chavard 2022-10-12 11:48:50 +02:00
parent 0f192fd752
commit 7f1dd49bdc
7 changed files with 9 additions and 9 deletions

View file

@ -56,7 +56,7 @@ class TypesDeChampEditor::ChampComponent < ApplicationComponent
end
def types_of_type_de_champ
if Flipper.enabled?(:categories_type_de_champ, controller.current_user)
if feature_enabled?(:categories_type_de_champ)
cat_scope = "activerecord.attributes.type_de_champ.categorie"
tdc_scope = "activerecord.attributes.type_de_champ.type_champs"
@ -105,7 +105,7 @@ class TypesDeChampEditor::ChampComponent < ApplicationComponent
def filter_featured_type_champ(type_champ)
feature_name = TypeDeChamp::FEATURE_FLAGS[type_champ]
feature_name.blank? || Flipper.enabled?(feature_name, helpers.current_user)
feature_name.blank? || feature_enabled?(feature_name)
end
def filter_type_champ(type_champ)
@ -133,7 +133,7 @@ class TypesDeChampEditor::ChampComponent < ApplicationComponent
if type_de_champ.private? || coordinate.child?
false
else
procedure.feature_enabled?(:procedure_conditional) || Flipper.enabled?(:conditional, controller.current_user)
procedure.feature_enabled?(:procedure_conditional)
end
end
end

View file

@ -19,7 +19,7 @@
%span.sr-only Déplacer le champ vers le bas
.cell.flex.justify-start.column.flex-grow
= form.label :type_champ, "Type de champ", for: dom_id(type_de_champ, :type_champ)
- if Flipper.enabled?(:categories_type_de_champ, controller.current_user)
- if feature_enabled?(:categories_type_de_champ)
= form.select :type_champ, grouped_options_for_select(types_of_type_de_champ, type_de_champ.type_champ), {}, class: 'small-margin small inline width-100', id: dom_id(type_de_champ, :type_champ)
- else
= form.select :type_champ, types_of_type_de_champ, {}, class: 'small-margin small inline width-100', id: dom_id(type_de_champ, :type_champ)

View file

@ -53,7 +53,7 @@ class Commentaire < ApplicationRecord
def redacted_email
if sent_by_instructeur?
if Flipper.enabled?(:hide_instructeur_email, dossier.procedure)
if dossier.procedure.feature_enabled?(:hide_instructeur_email)
"Instructeur n° #{instructeur.id}"
else
instructeur.email.split('@').first

View file

@ -666,7 +666,7 @@ class Procedure < ApplicationRecord
end
def missing_zones?
if Flipper.enabled?(:zonage)
if feature_enabled?(:zonage)
zones.empty?
else
false

View file

@ -62,7 +62,7 @@
= f.label :lien_dpo, 'Lien ou email pour contacter le Délégué à la Protection des Données (DPO)'
= f.text_field :lien_dpo, class: 'form-control'
- if Flipper.enabled? :opendata, @procedure
- if @procedure.feature_enabled?(:opendata)
%h3.header-subsection= t(:opendata_header, scope: [:administrateurs, :informations])
%p.notice= t(:opendata_notice_html, scope: [:administrateurs, :informations])
%p.notice= t(:opendata, scope: [:administrateurs, :informations])

View file

@ -58,7 +58,7 @@
%h2.procedure-admin-explanation Indispensable avant publication
.procedure-grid
= render Procedure::Card::PresentationComponent.new(procedure: @procedure)
= render Procedure::Card::ZonesComponent.new(procedure: @procedure) if Flipper.enabled? :zonage
= render Procedure::Card::ZonesComponent.new(procedure: @procedure) if @procedure.feature_enabled?(:zonage)
= render Procedure::Card::ChampsComponent.new(procedure: @procedure)
= render Procedure::Card::ServiceComponent.new(procedure: @procedure, administrateur: current_administrateur)
= render Procedure::Card::AdministrateursComponent.new(procedure: @procedure)

View file

@ -14,7 +14,7 @@
= f.label :zone do
= t('zone', scope: 'activerecord.attributes.procedure')
- if Flipper.enabled? :zonage
- if @procedure.feature_enabled?(:zonage)
= f.collection_check_boxes :zone_ids, Zone.available_at(@procedure.published_or_created_at), :id, :label do |b|
.editable-champ.editable-champ-checkbox
= b.check_box