Merge pull request #8149 from demarches-simplifiees/clean_flipper
clean(flipper): retire des anciennes conditions
This commit is contained in:
commit
f6efff13d0
7 changed files with 29 additions and 49 deletions
|
@ -58,7 +58,6 @@ module Experts
|
||||||
|
|
||||||
def create_avis
|
def create_avis
|
||||||
@procedure = Procedure.find(params[:procedure_id])
|
@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?
|
if @new_avis.nil?
|
||||||
|
@ -67,10 +66,6 @@ module Experts
|
||||||
set_avis_and_dossier
|
set_avis_and_dossier
|
||||||
render :instruction
|
render :instruction
|
||||||
end
|
end
|
||||||
else
|
|
||||||
flash.alert = "Cette démarche ne vous permet pas de demander un avis externe"
|
|
||||||
redirect_to instruction_expert_avis_path(avis.procedure, avis)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
.send-wrapper
|
.send-wrapper
|
||||||
= f.submit 'Envoyer votre avis', class: 'fr-btn'
|
= 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 }
|
= 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?
|
- if @dossier.avis_for_expert(current_expert).present?
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
.send-wrapper
|
.send-wrapper
|
||||||
= f.submit 'Envoyer votre avis', class: 'fr-btn'
|
= 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 }
|
= 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?
|
- if @dossier.avis_for(current_instructeur).present?
|
||||||
|
|
|
@ -1,10 +1,3 @@
|
||||||
Flipper.register('Administrateurs') do |user|
|
|
||||||
user.administrateur_id.present?
|
|
||||||
end
|
|
||||||
Flipper.register('Instructeurs') do |user|
|
|
||||||
user.instructeur_id.present?
|
|
||||||
end
|
|
||||||
|
|
||||||
# This setup is primarily for first deployment, because consequently
|
# This setup is primarily for first deployment, because consequently
|
||||||
# we can add new features from the Web UI. However when the new DB is created
|
# we can add new features from the Web UI. However when the new DB is created
|
||||||
# this will immediately migrate the default features to be controlled.
|
# this will immediately migrate the default features to be controlled.
|
||||||
|
@ -22,9 +15,7 @@ features = [
|
||||||
:administrateur_web_hook,
|
:administrateur_web_hook,
|
||||||
:api_particulier,
|
:api_particulier,
|
||||||
:dossier_pdf_vide,
|
:dossier_pdf_vide,
|
||||||
:expert_not_allowed_to_invite,
|
|
||||||
:hide_instructeur_email,
|
:hide_instructeur_email,
|
||||||
:procedure_revisions,
|
|
||||||
:procedure_routage_api
|
:procedure_routage_api
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
22
lib/tasks/deployment/20221128205201_clean_old_gates.rake
Normal file
22
lib/tasks/deployment/20221128205201_clean_old_gates.rake
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
namespace :after_party do
|
||||||
|
desc 'Deployment task: clean_old_gates'
|
||||||
|
task clean_old_gates: :environment do
|
||||||
|
puts "Running deploy task 'clean_old_gates'"
|
||||||
|
|
||||||
|
[
|
||||||
|
'procedure_revisions',
|
||||||
|
'instructeur_bypass_email_login_token',
|
||||||
|
'procedure_conditional',
|
||||||
|
'admin_affect_experts_to_avis'
|
||||||
|
].each do |key|
|
||||||
|
Flipper::Adapters::ActiveRecord::Gate.where(feature_key: key).destroy_all
|
||||||
|
end
|
||||||
|
|
||||||
|
# Put your task implementation HERE.
|
||||||
|
|
||||||
|
# Update task as completed. If you remove the line below, the task will
|
||||||
|
# run with every deploy (or every time you call after_party:run).
|
||||||
|
AfterParty::TaskRecord
|
||||||
|
.create version: AfterParty::TaskRecorder.new(__FILE__).timestamp
|
||||||
|
end
|
||||||
|
end
|
|
@ -326,26 +326,6 @@ describe Experts::AvisController, type: :controller do
|
||||||
end
|
end
|
||||||
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
|
describe '#create_avis' do
|
||||||
let(:previous_avis_confidentiel) { false }
|
let(:previous_avis_confidentiel) { false }
|
||||||
let(:previous_revoked_at) { nil }
|
let(:previous_revoked_at) { nil }
|
||||||
|
|
|
@ -23,12 +23,4 @@ describe 'experts/avis/instruction.html.haml', type: :view do
|
||||||
let(:confidentiel) { false }
|
let(:confidentiel) { false }
|
||||||
it { is_expected.to have_text("Cet avis est partagé avec les autres experts") }
|
it { is_expected.to have_text("Cet avis est partagé avec les autres experts") }
|
||||||
end
|
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
|
end
|
||||||
|
|
Loading…
Reference in a new issue