fix: remove condition from annotations and children

This commit is contained in:
simon lehericey 2022-07-12 13:56:53 +02:00
parent 6f7fb9841c
commit 53fe3c3dd8
3 changed files with 3 additions and 12 deletions

View file

@ -77,4 +77,5 @@
= 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::ConditionsComponent.new(tdc: type_de_champ, upper_tdcs: @upper_coordinates.map(&:type_de_champ), procedure_id: procedure.id))
- if Flipper.enabled?(:conditional, controller.current_user) && !type_de_champ.private? && !coordinate.child?
= render(TypesDeChampEditor::ConditionsComponent.new(tdc: type_de_champ, upper_tdcs: @upper_coordinates.map(&:type_de_champ), procedure_id: procedure.id))

View file

@ -201,11 +201,7 @@ class TypesDeChampEditor::ConditionsComponent < ApplicationComponent
end
def render?
if Flipper.enabled?(:conditional, controller.current_user)
@condition.present? || available_targets_for_select.any?
else
false
end
@condition.present? || available_targets_for_select.any?
end
def input_name_for(name)

View file

@ -1,12 +1,6 @@
describe TypesDeChampEditor::ConditionsComponent, type: :component do
include Logic
# TODO: remove along with feature flipping
before do
allow_any_instance_of(ApplicationController).to receive(:current_user).and_return(nil)
allow(Flipper).to receive(:enabled?).with(:conditional, anything).and_return(true)
end
describe 'render' do
let(:tdc) { create(:type_de_champ, condition: condition) }
let(:condition) { nil }