diff --git a/app/controllers/experts/avis_controller.rb b/app/controllers/experts/avis_controller.rb index 2e964badd..4971fc676 100644 --- a/app/controllers/experts/avis_controller.rb +++ b/app/controllers/experts/avis_controller.rb @@ -58,18 +58,13 @@ module Experts def create_avis @procedure = Procedure.find(params[:procedure_id]) - if !@procedure.feature_enabled?(:expert_not_allowed_to_invite) - @new_avis = create_avis_from_params(avis.dossier, current_expert, avis.confidentiel) + @new_avis = create_avis_from_params(avis.dossier, current_expert, avis.confidentiel) - if @new_avis.nil? - redirect_to instruction_expert_avis_path(avis.procedure, avis) - else - set_avis_and_dossier - render :instruction - end - else - flash.alert = "Cette démarche ne vous permet pas de demander un avis externe" + if @new_avis.nil? redirect_to instruction_expert_avis_path(avis.procedure, avis) + else + set_avis_and_dossier + render :instruction end end diff --git a/app/views/experts/avis/instruction.html.haml b/app/views/experts/avis/instruction.html.haml index b1604da53..914587395 100644 --- a/app/views/experts/avis/instruction.html.haml +++ b/app/views/experts/avis/instruction.html.haml @@ -31,7 +31,7 @@ .send-wrapper = f.submit 'Envoyer votre avis', class: 'fr-btn' - - if !@dossier.termine? && !@avis.procedure.feature_enabled?(:expert_not_allowed_to_invite) + - if !@dossier.termine? = render partial: "experts/shared/avis/form", locals: { url: avis_expert_avis_path(@avis.procedure, @avis), linked_dossiers: @dossier.linked_dossiers_for(current_expert), must_be_confidentiel: @avis.confidentiel?, avis: @new_avis } - if @dossier.avis_for_expert(current_expert).present? diff --git a/app/views/instructeurs/avis/instruction.html.haml b/app/views/instructeurs/avis/instruction.html.haml index a48ecb92e..fb9c18335 100644 --- a/app/views/instructeurs/avis/instruction.html.haml +++ b/app/views/instructeurs/avis/instruction.html.haml @@ -31,7 +31,7 @@ .send-wrapper = f.submit 'Envoyer votre avis', class: 'fr-btn' - - if !@dossier.termine? && !@avis.procedure.feature_enabled?(:expert_not_allowed_to_invite) + - if !@dossier.termine? = 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? diff --git a/config/initializers/flipper.rb b/config/initializers/flipper.rb index 4c3c5a280..0d7e3fc19 100644 --- a/config/initializers/flipper.rb +++ b/config/initializers/flipper.rb @@ -15,7 +15,6 @@ features = [ :administrateur_web_hook, :api_particulier, :dossier_pdf_vide, - :expert_not_allowed_to_invite, :hide_instructeur_email, :procedure_routage_api ] diff --git a/spec/controllers/experts/avis_controller_spec.rb b/spec/controllers/experts/avis_controller_spec.rb index 4502f3ccb..0f66094a2 100644 --- a/spec/controllers/experts/avis_controller_spec.rb +++ b/spec/controllers/experts/avis_controller_spec.rb @@ -326,26 +326,6 @@ describe Experts::AvisController, type: :controller do end end - describe '#expert_cannot_invite_another_expert' do - let!(:previous_avis) { create(:avis, dossier: dossier, claimant: claimant, experts_procedure: experts_procedure, confidentiel: previous_avis_confidentiel) } - let(:previous_avis_confidentiel) { false } - let(:asked_confidentiel) { false } - let(:intro) { 'introduction' } - let(:emails) { "[\"toto@totomail.com\"]" } - let(:invite_linked_dossiers) { nil } - - before do - Flipper.enable_actor(:expert_not_allowed_to_invite, procedure) - post :create_avis, params: { id: previous_avis.id, procedure_id: procedure.id, avis: { emails: emails, introduction: intro, confidentiel: asked_confidentiel, invite_linked_dossiers: invite_linked_dossiers, introduction_file: @introduction_file } } - end - - context 'when the expert cannot invite another expert' do - let(:asked_confidentiel) { false } - it { expect(flash.alert).to eq("Cette démarche ne vous permet pas de demander un avis externe") } - it { expect(response).to redirect_to(instruction_expert_avis_path(procedure, previous_avis)) } - end - end - describe '#create_avis' do let(:previous_avis_confidentiel) { false } let(:previous_revoked_at) { nil } diff --git a/spec/views/experts/avis/instruction.html.haml_spec.rb b/spec/views/experts/avis/instruction.html.haml_spec.rb index 5ce2a54ef..b360f9e82 100644 --- a/spec/views/experts/avis/instruction.html.haml_spec.rb +++ b/spec/views/experts/avis/instruction.html.haml_spec.rb @@ -23,12 +23,4 @@ describe 'experts/avis/instruction.html.haml', type: :view do let(:confidentiel) { false } it { is_expected.to have_text("Cet avis est partagé avec les autres experts") } end - - context 'when an expert is not allowed to invite another expert' do - let(:confidentiel) { false } - before do - Flipper.enable(:expert_not_allowed_to_invite, avis.procedure) - end - it { is_expected.to have_no_text("Inviter des personnes à donner leur avis") } - end end