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
|
def redirect_if_untrusted
|
||||||
if instructeur_signed_in? &&
|
if instructeur_signed_in? &&
|
||||||
sensitive_path &&
|
sensitive_path &&
|
||||||
Flipflop.enable_email_login_token? &&
|
!Flipflop.bypass_email_login_token? &&
|
||||||
!IPService.ip_trusted?(request.headers['X-Forwarded-For']) &&
|
!IPService.ip_trusted?(request.headers['X-Forwarded-For']) &&
|
||||||
!trusted_device?
|
!trusted_device?
|
||||||
|
|
||||||
|
|
|
@ -64,8 +64,7 @@ module ProcedureHelper
|
||||||
private
|
private
|
||||||
|
|
||||||
TOGGLES = {
|
TOGGLES = {
|
||||||
TypeDeChamp.type_champs.fetch(:integer_number) => :champ_integer_number?,
|
TypeDeChamp.type_champs.fetch(:integer_number) => :champ_integer_number?
|
||||||
TypeDeChamp.type_champs.fetch(:repetition) => :champ_repetition?
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def types_de_champ_types
|
def types_de_champ_types
|
||||||
|
|
|
@ -4,11 +4,8 @@
|
||||||
Télécharger tous les dossiers
|
Télécharger tous les dossiers
|
||||||
- old_format_limit_date = Date.parse("Oct 31 2019")
|
- old_format_limit_date = Date.parse("Oct 31 2019")
|
||||||
- export_v1_enabled = old_format_limit_date > Time.zone.today
|
- export_v1_enabled = old_format_limit_date > Time.zone.today
|
||||||
- export_v2_enabled = Flipflop.procedure_export_v2_enabled? || !export_v1_enabled
|
.dropdown-content.fade-in-down{ style: !export_v1_enabled ? 'width: 330px' : '' }
|
||||||
- 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' : '' }
|
|
||||||
%ul.dropdown-items
|
%ul.dropdown-items
|
||||||
- if export_v2_enabled
|
|
||||||
%li
|
%li
|
||||||
= link_to "Au format .xlsx", procedure_dossiers_download_path(procedure, format: :xlsx, version: 'v2'), target: "_blank", rel: "noopener"
|
= link_to "Au format .xlsx", procedure_dossiers_download_path(procedure, format: :xlsx, version: 'v2'), target: "_blank", rel: "noopener"
|
||||||
%li
|
%li
|
||||||
|
@ -16,6 +13,7 @@
|
||||||
%li
|
%li
|
||||||
= link_to "Au format .csv", procedure_dossiers_download_path(procedure, format: :csv, version: 'v2'), target: "_blank", rel: "noopener"
|
= link_to "Au format .csv", procedure_dossiers_download_path(procedure, format: :csv, version: 'v2'), target: "_blank", rel: "noopener"
|
||||||
- if export_v1_enabled
|
- if export_v1_enabled
|
||||||
|
- old_format_message = "(ancien format, jusqu’au #{old_format_limit_date.strftime('%d/%m/%Y')})"
|
||||||
%li
|
%li
|
||||||
= link_to "Au format .xlsx #{old_format_message}", procedure_dossiers_download_path(procedure, format: :xlsx, version: 'v1'), target: "_blank", rel: "noopener"
|
= link_to "Au format .xlsx #{old_format_message}", procedure_dossiers_download_path(procedure, format: :xlsx, version: 'v1'), target: "_blank", rel: "noopener"
|
||||||
%li
|
%li
|
||||||
|
|
|
@ -9,17 +9,14 @@ Flipflop.configure do
|
||||||
group :champs do
|
group :champs do
|
||||||
feature :champ_integer_number,
|
feature :champ_integer_number,
|
||||||
title: "Champ nombre entier"
|
title: "Champ nombre entier"
|
||||||
feature :champ_repetition,
|
|
||||||
title: "Bloc répétable"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
feature :web_hook
|
feature :web_hook
|
||||||
feature :enable_email_login_token
|
|
||||||
|
|
||||||
feature :procedure_export_v2_enabled
|
|
||||||
feature :operation_log_serialize_subject
|
feature :operation_log_serialize_subject
|
||||||
feature :download_as_zip_enabled,
|
feature :download_as_zip_enabled
|
||||||
default: false
|
feature :bypass_email_login_token,
|
||||||
|
default: Rails.env.test?
|
||||||
|
|
||||||
group :development do
|
group :development do
|
||||||
feature :mini_profiler_enabled,
|
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,14 +166,13 @@ describe ApplicationController, type: :controller do
|
||||||
context 'when the path is sensitive' do
|
context 'when the path is sensitive' do
|
||||||
let(:sensitive_path) { true }
|
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
|
context 'when the instructeur is signed_in' do
|
||||||
let(:instructeur_signed_in) { true }
|
let(:instructeur_signed_in) { true }
|
||||||
|
|
||||||
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 not trusted' do
|
context 'when the ip is not trusted' do
|
||||||
let(:ip_trusted) { false }
|
let(:ip_trusted) { false }
|
||||||
|
|
||||||
|
@ -184,16 +183,6 @@ describe ApplicationController, type: :controller do
|
||||||
|
|
||||||
it { expect(@controller).not_to have_received(:redirect_to) }
|
it { expect(@controller).not_to have_received(:redirect_to) }
|
||||||
end
|
end
|
||||||
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 untrusted' do
|
|
||||||
let(:ip_trusted) { false }
|
|
||||||
|
|
||||||
context 'when the device is not trusted' do
|
context 'when the device is not trusted' do
|
||||||
let(:trusted_device) { false }
|
let(:trusted_device) { false }
|
||||||
|
@ -221,4 +210,3 @@ describe ApplicationController, type: :controller do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
|
@ -17,7 +17,6 @@ describe Users::SessionsController, type: :controller do
|
||||||
let(:send_password) { password }
|
let(:send_password) { password }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
Flipflop::FeatureSet.current.test!.switch!(:enable_email_login_token, true)
|
|
||||||
allow(controller).to receive(:trusted_device?).and_return(trusted_device)
|
allow(controller).to receive(:trusted_device?).and_return(trusted_device)
|
||||||
allow(InstructeurMailer).to receive(:send_login_token).and_return(double(deliver_later: true))
|
allow(InstructeurMailer).to receive(:send_login_token).and_return(double(deliver_later: true))
|
||||||
end
|
end
|
||||||
|
@ -28,6 +27,9 @@ describe Users::SessionsController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when the device is not trusted' do
|
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 }
|
let(:trusted_device) { false }
|
||||||
|
|
||||||
it 'redirects to the send_linked_path' do
|
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!(:procedure) { create(:procedure, :published, instructeurs: [instructeur]) }
|
||||||
let!(:dossier) { create(:dossier, state: Dossier.states.fetch(:en_construction), procedure: procedure) }
|
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
|
context 'the instructeur is also a user' do
|
||||||
scenario 'a instructeur can fill a dossier' do
|
scenario 'a instructeur can fill a dossier' do
|
||||||
visit commencer_path(path: procedure.path)
|
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) }
|
let(:procedure) { create(:procedure) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
Flipflop::FeatureSet.current.test!.switch!(:champ_repetition, true)
|
|
||||||
login_as administrateur, scope: :administrateur
|
login_as administrateur, scope: :administrateur
|
||||||
visit champs_procedure_path(procedure)
|
visit champs_procedure_path(procedure)
|
||||||
end
|
end
|
||||||
|
|
|
@ -12,10 +12,6 @@ describe Instructeur, type: :model do
|
||||||
assign(procedure_2)
|
assign(procedure_2)
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'default features' do
|
|
||||||
it { expect(instructeur.features).to eq({ "enable_email_login_token" => true }) }
|
|
||||||
end
|
|
||||||
|
|
||||||
describe '#visible_procedures' do
|
describe '#visible_procedures' do
|
||||||
let(:procedure_not_assigned) { create :procedure, administrateur: admin }
|
let(:procedure_not_assigned) { create :procedure, administrateur: admin }
|
||||||
let(:procedure_with_default_path) { 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_email, with: email
|
||||||
fill_in :user_password, with: password
|
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
|
perform_enqueued_jobs do
|
||||||
click_on 'Se connecter'
|
click_on 'Se connecter'
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue