Enable some flags for all (#4158)
Activation des blocs répératables et de l'export tableur v2 pour toutes les démarches
This commit is contained in:
commit
8082751912
11 changed files with 45 additions and 74 deletions
|
@ -183,7 +183,7 @@ class ApplicationController < ActionController::Base
|
|||
def redirect_if_untrusted
|
||||
if instructeur_signed_in? &&
|
||||
sensitive_path &&
|
||||
Flipflop.enable_email_login_token? &&
|
||||
!Flipflop.bypass_email_login_token? &&
|
||||
!IPService.ip_trusted?(request.headers['X-Forwarded-For']) &&
|
||||
!trusted_device?
|
||||
|
||||
|
|
|
@ -64,8 +64,7 @@ module ProcedureHelper
|
|||
private
|
||||
|
||||
TOGGLES = {
|
||||
TypeDeChamp.type_champs.fetch(:integer_number) => :champ_integer_number?,
|
||||
TypeDeChamp.type_champs.fetch(:repetition) => :champ_repetition?
|
||||
TypeDeChamp.type_champs.fetch(:integer_number) => :champ_integer_number?
|
||||
}
|
||||
|
||||
def types_de_champ_types
|
||||
|
|
|
@ -4,18 +4,16 @@
|
|||
Télécharger tous les dossiers
|
||||
- old_format_limit_date = Date.parse("Oct 31 2019")
|
||||
- export_v1_enabled = old_format_limit_date > Time.zone.today
|
||||
- export_v2_enabled = Flipflop.procedure_export_v2_enabled? || !export_v1_enabled
|
||||
- old_format_message = export_v1_enabled && export_v2_enabled ? "(ancien format, jusqu’au #{old_format_limit_date.strftime('%d/%m/%Y')})" : ''
|
||||
.dropdown-content.fade-in-down{ style: export_v1_enabled && export_v2_enabled ? 'width: 330px' : '' }
|
||||
.dropdown-content.fade-in-down{ style: !export_v1_enabled ? 'width: 330px' : '' }
|
||||
%ul.dropdown-items
|
||||
- if export_v2_enabled
|
||||
%li
|
||||
= link_to "Au format .xlsx", procedure_dossiers_download_path(procedure, format: :xlsx, version: 'v2'), target: "_blank", rel: "noopener"
|
||||
%li
|
||||
= link_to "Au format .ods", procedure_dossiers_download_path(procedure, format: :ods, version: 'v2'), target: "_blank", rel: "noopener"
|
||||
%li
|
||||
= link_to "Au format .csv", procedure_dossiers_download_path(procedure, format: :csv, version: 'v2'), target: "_blank", rel: "noopener"
|
||||
%li
|
||||
= link_to "Au format .xlsx", procedure_dossiers_download_path(procedure, format: :xlsx, version: 'v2'), target: "_blank", rel: "noopener"
|
||||
%li
|
||||
= link_to "Au format .ods", procedure_dossiers_download_path(procedure, format: :ods, version: 'v2'), target: "_blank", rel: "noopener"
|
||||
%li
|
||||
= link_to "Au format .csv", procedure_dossiers_download_path(procedure, format: :csv, version: 'v2'), target: "_blank", rel: "noopener"
|
||||
- if export_v1_enabled
|
||||
- old_format_message = "(ancien format, jusqu’au #{old_format_limit_date.strftime('%d/%m/%Y')})"
|
||||
%li
|
||||
= link_to "Au format .xlsx #{old_format_message}", procedure_dossiers_download_path(procedure, format: :xlsx, version: 'v1'), target: "_blank", rel: "noopener"
|
||||
%li
|
||||
|
|
|
@ -9,17 +9,14 @@ Flipflop.configure do
|
|||
group :champs do
|
||||
feature :champ_integer_number,
|
||||
title: "Champ nombre entier"
|
||||
feature :champ_repetition,
|
||||
title: "Bloc répétable"
|
||||
end
|
||||
|
||||
feature :web_hook
|
||||
feature :enable_email_login_token
|
||||
|
||||
feature :procedure_export_v2_enabled
|
||||
feature :operation_log_serialize_subject
|
||||
feature :download_as_zip_enabled,
|
||||
default: false
|
||||
feature :download_as_zip_enabled
|
||||
feature :bypass_email_login_token,
|
||||
default: Rails.env.test?
|
||||
|
||||
group :development do
|
||||
feature :mini_profiler_enabled,
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
namespace :'activate_trusted_device_for_a-f' do
|
||||
task run: :environment do
|
||||
letters_a_to_f = ('a'..'f').to_a
|
||||
Gestionnaire
|
||||
.where("substr(email, 1, 1) IN (?)", letters_a_to_f)
|
||||
.update_all(features: { "enable_email_login_token" => true })
|
||||
end
|
||||
end
|
|
@ -166,56 +166,44 @@ describe ApplicationController, type: :controller do
|
|||
context 'when the path is sensitive' do
|
||||
let(:sensitive_path) { true }
|
||||
|
||||
before do
|
||||
Flipflop::FeatureSet.current.test!.switch!(:bypass_email_login_token, false)
|
||||
end
|
||||
|
||||
context 'when the instructeur is signed_in' do
|
||||
let(:instructeur_signed_in) { true }
|
||||
|
||||
context 'when the feature is activated' do
|
||||
before do
|
||||
Flipflop::FeatureSet.current.test!.switch!(:enable_email_login_token, true)
|
||||
context 'when the ip is not trusted' do
|
||||
let(:ip_trusted) { false }
|
||||
|
||||
context 'when the device is trusted' do
|
||||
let(:trusted_device) { true }
|
||||
|
||||
before { subject }
|
||||
|
||||
it { expect(@controller).not_to have_received(:redirect_to) }
|
||||
end
|
||||
|
||||
context 'when the ip is not trusted' do
|
||||
let(:ip_trusted) { false }
|
||||
context 'when the device is not trusted' do
|
||||
let(:trusted_device) { false }
|
||||
|
||||
context 'when the device is trusted' do
|
||||
let(:trusted_device) { true }
|
||||
before { subject }
|
||||
|
||||
before { subject }
|
||||
|
||||
it { expect(@controller).not_to have_received(:redirect_to) }
|
||||
end
|
||||
it { expect(@controller).to have_received(:redirect_to) }
|
||||
it { expect(@controller).to have_received(:send_login_token_or_bufferize) }
|
||||
it { expect(@controller).to have_received(:store_location_for) }
|
||||
end
|
||||
end
|
||||
|
||||
context 'when the feature is activated' do
|
||||
before do
|
||||
Flipflop::FeatureSet.current.test!.switch!(:enable_email_login_token, true)
|
||||
end
|
||||
context 'when the ip is trusted' do
|
||||
let(:ip_trusted) { true }
|
||||
|
||||
context 'when the ip is untrusted' do
|
||||
let(:ip_trusted) { false }
|
||||
context 'when the device is not trusted' do
|
||||
let(:trusted_device) { false }
|
||||
|
||||
context 'when the device is not trusted' do
|
||||
let(:trusted_device) { false }
|
||||
before { subject }
|
||||
|
||||
before { subject }
|
||||
|
||||
it { expect(@controller).to have_received(:redirect_to) }
|
||||
it { expect(@controller).to have_received(:send_login_token_or_bufferize) }
|
||||
it { expect(@controller).to have_received(:store_location_for) }
|
||||
end
|
||||
end
|
||||
|
||||
context 'when the ip is trusted' do
|
||||
let(:ip_trusted) { true }
|
||||
|
||||
context 'when the device is not trusted' do
|
||||
let(:trusted_device) { false }
|
||||
|
||||
before { subject }
|
||||
|
||||
it { expect(@controller).not_to have_received(:redirect_to) }
|
||||
end
|
||||
it { expect(@controller).not_to have_received(:redirect_to) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -17,7 +17,6 @@ describe Users::SessionsController, type: :controller do
|
|||
let(:send_password) { password }
|
||||
|
||||
before do
|
||||
Flipflop::FeatureSet.current.test!.switch!(:enable_email_login_token, true)
|
||||
allow(controller).to receive(:trusted_device?).and_return(trusted_device)
|
||||
allow(InstructeurMailer).to receive(:send_login_token).and_return(double(deliver_later: true))
|
||||
end
|
||||
|
@ -28,6 +27,9 @@ describe Users::SessionsController, type: :controller do
|
|||
end
|
||||
|
||||
context 'when the device is not trusted' do
|
||||
before do
|
||||
Flipflop::FeatureSet.current.test!.switch!(:bypass_email_login_token, false)
|
||||
end
|
||||
let(:trusted_device) { false }
|
||||
|
||||
it 'redirects to the send_linked_path' do
|
||||
|
|
|
@ -9,10 +9,6 @@ feature 'The instructeur part' do
|
|||
let!(:procedure) { create(:procedure, :published, instructeurs: [instructeur]) }
|
||||
let!(:dossier) { create(:dossier, state: Dossier.states.fetch(:en_construction), procedure: procedure) }
|
||||
|
||||
before do
|
||||
Flipflop::FeatureSet.current.test!.switch!(:enable_email_login_token, true)
|
||||
end
|
||||
|
||||
context 'the instructeur is also a user' do
|
||||
scenario 'a instructeur can fill a dossier' do
|
||||
visit commencer_path(path: procedure.path)
|
||||
|
|
|
@ -5,7 +5,6 @@ feature 'As an administrateur I can edit types de champ', js: true do
|
|||
let(:procedure) { create(:procedure) }
|
||||
|
||||
before do
|
||||
Flipflop::FeatureSet.current.test!.switch!(:champ_repetition, true)
|
||||
login_as administrateur, scope: :administrateur
|
||||
visit champs_procedure_path(procedure)
|
||||
end
|
||||
|
|
|
@ -12,10 +12,6 @@ describe Instructeur, type: :model do
|
|||
assign(procedure_2)
|
||||
end
|
||||
|
||||
describe 'default features' do
|
||||
it { expect(instructeur.features).to eq({ "enable_email_login_token" => true }) }
|
||||
end
|
||||
|
||||
describe '#visible_procedures' do
|
||||
let(:procedure_not_assigned) { create :procedure, administrateur: admin }
|
||||
let(:procedure_with_default_path) { create :procedure, administrateur: admin }
|
||||
|
|
|
@ -21,6 +21,10 @@ module FeatureHelpers
|
|||
fill_in :user_email, with: email
|
||||
fill_in :user_password, with: password
|
||||
|
||||
if sign_in_by_link
|
||||
Flipflop::FeatureSet.current.test!.switch!(:bypass_email_login_token, false)
|
||||
end
|
||||
|
||||
perform_enqueued_jobs do
|
||||
click_on 'Se connecter'
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue