Merge pull request #7652 from tchak/fix-conditionel-activation-by-procedure
fix(conditional): enable conditional per procedure
This commit is contained in:
commit
6625f30fc3
4 changed files with 11 additions and 3 deletions
|
@ -109,4 +109,12 @@ class TypesDeChampEditor::ChampComponent < ApplicationComponent
|
||||||
def has_legacy_number?
|
def has_legacy_number?
|
||||||
revision.types_de_champ.any?(&:legacy_number?)
|
revision.types_de_champ.any?(&:legacy_number?)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def conditional_enabled?
|
||||||
|
if type_de_champ.private? || coordinate.child?
|
||||||
|
false
|
||||||
|
else
|
||||||
|
procedure.feature_enabled?(:procedure_conditional) || Flipper.enabled?(:conditional, controller.current_user)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -77,5 +77,5 @@
|
||||||
= render TypesDeChampEditor::BlockComponent.new(block: coordinate, coordinates: coordinate.revision_types_de_champ)
|
= render TypesDeChampEditor::BlockComponent.new(block: coordinate, coordinates: coordinate.revision_types_de_champ)
|
||||||
= render TypesDeChampEditor::AddChampButtonComponent.new(revision: coordinate.revision, parent: coordinate, is_annotation: coordinate.private?)
|
= render TypesDeChampEditor::AddChampButtonComponent.new(revision: coordinate.revision, parent: coordinate, is_annotation: coordinate.private?)
|
||||||
|
|
||||||
- if Flipper.enabled?(:conditional, controller.current_user) && !type_de_champ.private? && !coordinate.child?
|
- if conditional_enabled?
|
||||||
= render(TypesDeChampEditor::ConditionsComponent.new(tdc: type_de_champ, upper_tdcs: @upper_coordinates.map(&:type_de_champ), procedure_id: procedure.id))
|
= render(TypesDeChampEditor::ConditionsComponent.new(tdc: type_de_champ, upper_tdcs: @upper_coordinates.map(&:type_de_champ), procedure_id: procedure.id))
|
||||||
|
|
|
@ -26,7 +26,7 @@ features = [
|
||||||
:hide_instructeur_email,
|
:hide_instructeur_email,
|
||||||
:procedure_revisions,
|
:procedure_revisions,
|
||||||
:procedure_routage_api,
|
:procedure_routage_api,
|
||||||
:procedure_process_expired_dossiers_termine
|
:procedure_conditional
|
||||||
]
|
]
|
||||||
|
|
||||||
def database_exists?
|
def database_exists?
|
||||||
|
|
|
@ -18,7 +18,7 @@ describe 'As an administrateur I can edit types de champ condition', js: true do
|
||||||
before do
|
before do
|
||||||
login_as administrateur.user, scope: :user
|
login_as administrateur.user, scope: :user
|
||||||
# TODO: remove along with feature flipping
|
# TODO: remove along with feature flipping
|
||||||
allow(Flipper).to receive(:enabled?).with(:conditional, anything).and_return(true)
|
Flipper.enable(:procedure_conditional, procedure)
|
||||||
visit champs_admin_procedure_path(procedure)
|
visit champs_admin_procedure_path(procedure)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue