Merge pull request #6940 from betagouv/main

2022-02-08-01
This commit is contained in:
Pierre de La Morinerie 2022-02-08 12:14:44 +01:00 committed by GitHub
commit dcc109d6c9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 134 additions and 64 deletions

View file

@ -674,15 +674,24 @@ Performance/UnfreezeString:
Performance/UriDefaultParser: Performance/UriDefaultParser:
Enabled: true Enabled: true
Rails:
Enabled: true
Rails/ActionFilter: Rails/ActionFilter:
Enabled: true Enabled: true
Rails/ActiveRecordAliases: Rails/ActiveRecordAliases:
Enabled: true Enabled: true
Rails/ActiveRecordCallbacksOrder:
Enabled: false
Rails/ActiveSupportAliases: Rails/ActiveSupportAliases:
Enabled: true Enabled: true
Rails/AfterCommitOverride:
Enabled: true
Rails/ApplicationJob: Rails/ApplicationJob:
Enabled: true Enabled: true
@ -692,8 +701,8 @@ Rails/ApplicationRecord:
Rails/ApplicationController: Rails/ApplicationController:
Enabled: false Enabled: false
Rails/RakeEnvironment: Rails/AttributeDefaultBlockValue:
Enabled: false Enabled: true
Rails/Blank: Rails/Blank:
Enabled: true Enabled: true
@ -739,6 +748,9 @@ Rails/FilePath:
Rails/FindBy: Rails/FindBy:
Enabled: true Enabled: true
Rails/FindById:
Enabled: true
Rails/FindEach: Rails/FindEach:
Enabled: true Enabled: true
@ -754,12 +766,24 @@ Rails/HttpPositionalArguments:
Rails/HttpStatus: Rails/HttpStatus:
Enabled: false Enabled: false
Rails/Inquiry:
Enabled: true
Rails/InverseOf: Rails/InverseOf:
Enabled: true Enabled: true
Rails/LexicallyScopedActionFilter: Rails/LexicallyScopedActionFilter:
Enabled: false Enabled: false
Rails/MailerName:
Enabled: true
Rails/MatchRoute:
Enabled: true
Rails/NegateInclude:
Enabled: false
Rails/NotNullColumn: Rails/NotNullColumn:
Enabled: false Enabled: false
@ -769,6 +793,12 @@ Rails/Output:
Rails/OutputSafety: Rails/OutputSafety:
Enabled: true Enabled: true
Rails/Pluck:
Enabled: false
Rails/PluckInWhere:
Enabled: true
Rails/PluralizationGrammar: Rails/PluralizationGrammar:
Enabled: true Enabled: true
@ -778,6 +808,9 @@ Rails/Presence:
Rails/Present: Rails/Present:
Enabled: true Enabled: true
Rails/RakeEnvironment:
Enabled: false
Rails/ReadWriteAttribute: Rails/ReadWriteAttribute:
Enabled: false Enabled: false
@ -790,6 +823,12 @@ Rails/RedundantReceiverInWithOptions:
Rails/RelativeDateConstant: Rails/RelativeDateConstant:
Enabled: true Enabled: true
Rails/RenderInline:
Enabled: true
Rails/RenderPlainText:
Enabled: true
Rails/RequestReferer: Rails/RequestReferer:
Enabled: true Enabled: true
@ -802,9 +841,15 @@ Rails/SaveBang:
Rails/ScopeArgs: Rails/ScopeArgs:
Enabled: true Enabled: true
Rails/ShortI18n:
Enabled: true
Rails/SkipsModelValidations: Rails/SkipsModelValidations:
Enabled: false Enabled: false
Rails/SquishedSQLHeredocs:
Enabled: true
Rails/TimeZone: Rails/TimeZone:
EnforcedStyle: strict EnforcedStyle: strict
@ -820,7 +865,13 @@ Rails/UnknownEnv:
Rails/Validation: Rails/Validation:
Enabled: true Enabled: true
Rails: Rails/WhereEquals:
Enabled: true
Rails/WhereExists:
Enabled: true
Rails/WhereNot:
Enabled: true Enabled: true
RSpec/Focused: RSpec/Focused:
@ -1323,37 +1374,3 @@ Style/YodaCondition:
Style/ZeroLengthPredicate: Style/ZeroLengthPredicate:
Enabled: true Enabled: true
Rails/ActiveRecordCallbacksOrder:
Enabled: false
Rails/AfterCommitOverride:
Enabled: true
Rails/AttributeDefaultBlockValue:
Enabled: true
Rails/FindById:
Enabled: true
Rails/Inquiry:
Enabled: true
Rails/MailerName:
Enabled: true
Rails/MatchRoute:
Enabled: true
Rails/NegateInclude:
Enabled: false
Rails/Pluck:
Enabled: false
Rails/PluckInWhere:
Enabled: true
Rails/RenderInline:
Enabled: true
Rails/RenderPlainText:
Enabled: true
Rails/ShortI18n:
Enabled: true
Rails/SquishedSQLHeredocs:
Enabled: true
Rails/WhereEquals:
Enabled: true
Rails/WhereExists:
Enabled: true
Rails/WhereNot:
Enabled: true

View file

@ -29,9 +29,8 @@ footer {
@extend %horizontal-list-item; @extend %horizontal-list-item;
font-size: 14px; font-size: 14px;
vertical-align: top; vertical-align: top;
flex-grow: 1; flex: 0 0 33.333333%;
min-width: 280px; min-width: 280px;
margin: 0 20px;
margin-bottom: 30px; margin-bottom: 30px;
@media (max-width: 550px) { @media (max-width: 550px) {
@ -68,19 +67,12 @@ footer {
opacity: 0.8; opacity: 0.8;
} }
.footer-logo-dinum {
@include ie-compatible-background-image("footer/logo-dinum.png");
height: 150px;
width: 202px;
margin-bottom: 14px;
}
.footer-logo-beta-gouv-fr { .footer-logo-beta-gouv-fr {
@include ie-compatible-background-image("footer/logo-beta-gouv-fr.svg"); @include ie-compatible-background-image("footer/logo-beta-gouv-fr.svg");
width: 150px; width: 150px;
height: 25px; height: 25px;
margin-top: 14px;
} }
.footer-logo-france { .footer-logo-france {

View file

@ -1,4 +1,6 @@
@import "colors"; @import "colors";
@import "constants";
$dark-grey: #333333; $dark-grey: #333333;
$light-grey: #999999; $light-grey: #999999;
@ -152,6 +154,7 @@ $big-number-card-padding: 2 * $segmented-control-item-border-radius;
.big-number-card-detail { .big-number-card-detail {
display: block; display: block;
margin-top: $default-padding;
text-align: center; text-align: center;
color: $blue-france-500; color: $blue-france-500;
} }

View file

@ -2,6 +2,7 @@ class Cron::PurgeManagerAdministrateurSessionsJob < Cron::CronJob
self.schedule_expression = "every day at 3 am" self.schedule_expression = "every day at 3 am"
def perform def perform
AdministrateursProcedure.where(manager: true).destroy_all # TODO: add id column to administrateurs_procedures and use destroy_all
AdministrateursProcedure.where(manager: true).delete_all
end end
end end

View file

@ -12,7 +12,7 @@ class TitreIdentiteWatermarkJob < ApplicationJob
MAX_IMAGE_SIZE = 1500 MAX_IMAGE_SIZE = 1500
SCALE = 0.9 SCALE = 0.9
WATERMARK = Rails.root.join("app/assets/images/#{WATERMARK_FILE}") WATERMARK = URI.parse(WATERMARK_FILE).is_a?(URI::HTTP) ? WATERMARK_FILE : Rails.root.join("app/assets/images/#{WATERMARK_FILE}")
def perform(blob) def perform(blob)
if blob.virus_scanner.pending? then raise FileNotScannedYetError end if blob.virus_scanner.pending? then raise FileNotScannedYetError end

View file

@ -1,6 +1,6 @@
#footer #footer
%p{ class: "copyright col-md-push-#{12-main_container_size} col-md-#{main_container_size} col-lg-push-#{12-main_container_size} col-lg-#{main_container_size} text-muted small" } %p{ class: "copyright col-md-push-#{12-main_container_size} col-md-#{main_container_size} col-lg-push-#{12-main_container_size} col-lg-#{main_container_size} text-muted small" }
= link_to 'DINUM', 'https://www.numerique.gouv.fr/dinum/' = link_to PROVIDER_NAME, PROVIDER_URL
= Time.zone.now.year = Time.zone.now.year
\- \-
= link_to 'Nouveautés', DOC_NOUVEAUTES_URL, target: '_blank' = link_to 'Nouveautés', DOC_NOUVEAUTES_URL, target: '_blank'

View file

@ -145,7 +145,7 @@
<tr> <tr>
<td style="word-wrap:break-word;font-size:0px;padding:0px 20px 0px 20px;padding-top:0px;padding-bottom:0px;" align="center"> <td style="word-wrap:break-word;font-size:0px;padding:0px 20px 0px 20px;padding-top:0px;padding-bottom:0px;" align="center">
<div class="" style="cursor:auto;color:#55575d;font-family:Helvetica, Arial, sans-serif;font-size:11px;line-height:22px;text-align:center;"> <div class="" style="cursor:auto;color:#55575d;font-family:Helvetica, Arial, sans-serif;font-size:11px;line-height:22px;text-align:center;">
<%= "#{APPLICATION_NAME}" %> est un service fourni par la DINUM <%= "#{APPLICATION_NAME}" %> est un service fourni par <%= PROVIDED_BY %>
</div> </div>
</td> </td>
</tr> </tr>

View file

@ -5,12 +5,13 @@
%li.footer-column %li.footer-column
%ul.footer-logos %ul.footer-logos
%li.footer-text %li.footer-text
Un service fourni par la Un service fourni par
= link_to "DINUM", "https://numerique.gouv.fr/", title: "Direction Interministérielle au Numérique" = link_to PROVIDED_BY, PROVIDER_URL, title: PROVIDER_TITLE
%br %br
%li %li
= link_to "https://numerique.gouv.fr/", title: "DINUM", 'aria-label': 'DINUM' do = link_to PROVIDER_URL, title: PROVIDER_NAME, 'aria-label': PROVIDER_NAME do
%span.footer-logo.footer-logo-dinum{ role: 'img', 'aria-label': 'Logo DINUM' } %span.footer-logo{ role: 'img', 'aria-label': PROVIDER_LOGO_ALT }
= image_tag PROVIDER_LOGO_SRC, alt: PROVIDER_LOGO_ALT, width: PROVIDER_LOGO_WIDTH, height: PROVIDER_LOGO_HEIGHT, loading: 'lazy'
= link_to "https://beta.gouv.fr", title: "le site de Beta.gouv.fr", 'aria-label': 'beta.gouv.fr' do = link_to "https://beta.gouv.fr", title: "le site de Beta.gouv.fr", 'aria-label': 'beta.gouv.fr' do
%span.footer-logo.footer-logo-beta-gouv-fr{ role: 'img', 'aria-label': 'Logo beta.gouv.fr' } %span.footer-logo.footer-logo-beta-gouv-fr{ role: 'img', 'aria-label': 'Logo beta.gouv.fr' }

View file

@ -89,3 +89,13 @@ DS_ENV="staging"
# Admins and instructeurs can freely change their email to these domains # Admins and instructeurs can freely change their email to these domains
# LEGIT_ADMIN_DOMAINS = "domaine_1.com;domaine_2.com" # LEGIT_ADMIN_DOMAINS = "domaine_1.com;domaine_2.com"
# Instance provider
# PROVIDED_BY="la DINUM"
# PROVIDER_NAME="DINUM"
# PROVIDER_TITLE="Direction Interministérielle au Numérique"
# PROVIDER_URL="https://numerique.gouv.fr/"
# PROVIDER_LOGO_SRC="footer/logo-dinum.png"
# PROVIDER_LOGO_ALT="Logo DINUM"
# PROVIDER_LOGO_HEIGHT="161"
# PROVIDER_LOGO_WIDTH="138"

View file

@ -0,0 +1,10 @@
# Instance provider
PROVIDED_BY = ENV.fetch("PROVIDED_BY", "la DINUM")
PROVIDER_NAME = ENV.fetch("PROVIDER_NAME", "DINUM")
PROVIDER_TITLE = ENV.fetch("PROVIDER_TITLE", "Direction Interministérielle au Numérique")
PROVIDER_URL = ENV.fetch("PROVIDER_URL", "https://numerique.gouv.fr/")
PROVIDER_LOGO_SRC = ENV.fetch("PROVIDER_LOGO_SRC", "footer/logo-dinum.png")
PROVIDER_LOGO_ALT = ENV.fetch("PROVIDER_LOGO_ALT", "Logo DINUM")
PROVIDER_LOGO_HEIGHT = ENV.fetch("PROVIDER_LOGO_HEIGHT", "161")
PROVIDER_LOGO_WIDTH = ENV.fetch("PROVIDER_LOGO_WIDTH", "138")

View file

@ -446,7 +446,7 @@ en:
procedures: procedures:
stats: stats:
usual_processing_time: "Usual processing time" usual_processing_time: "Usual processing time"
processing_time_description: "%{percentile}% of submitted files in the last %{span} days were processed in less than %{days} days." processing_time_description: "%{percentile}% of submitted files in the last %{span} days were processed in less than %{days}."
processing_time: "Processing time" processing_time: "Processing time"
since_procedure_creation: "since the procedure was created" since_procedure_creation: "since the procedure was created"
nb_days: "Nb Days" nb_days: "Nb Days"

View file

@ -487,7 +487,7 @@ fr:
procedures: procedures:
stats: stats:
usual_processing_time: "Temps de traitement usuel" usual_processing_time: "Temps de traitement usuel"
processing_time_description: "%{percentile}% des demandes des %{span} derniers jours ont été traitées en moins de %{days} jours." processing_time_description: "%{percentile}% des demandes des %{span} derniers jours ont été traitées en moins de %{days}."
processing_time: "Temps de traitement" processing_time: "Temps de traitement"
since_procedure_creation: "depuis le lancement de la démarche" since_procedure_creation: "depuis le lancement de la démarche"
nb_days: "Nb Jours" nb_days: "Nb Jours"

View file

@ -83,11 +83,11 @@ development:
test: test:
<<: *defaults <<: *defaults
secret_key_base: aa52abc3f3a629d04a61e9899a24c12f52b24c679cbf45f8ec0cdcc64ab9526d673adca84212882dff3911ac98e0c32ec4729ca7b3429ba18ef4dfd1bd18bc7a secret_key_base: aa52abc3f3a629d04a61e9899a24c12f52b24c679cbf45f8ec0cdcc64ab9526d673adca84212882dff3911ac98e0c32ec4729ca7b3429ba18ef4dfd1bd18bc7a # ggignore
encryption_service_salt: QUDyMoXyw2YXU8pHnpts3w9MyMpsMQ6BgP62obgCf7PQv encryption_service_salt: QUDyMoXyw2YXU8pHnpts3w9MyMpsMQ6BgP62obgCf7PQv # ggignore
otp_secret_key: 78ddda3679dc0ba2c99f50bcff04f49d862358dbeb7ead50368fdd6de14392be884ee10a204a0375b4b382e1a842fafe40d7858b7ab4796ec3a67c518d31112b otp_secret_key: 78ddda3679dc0ba2c99f50bcff04f49d862358dbeb7ead50368fdd6de14392be884ee10a204a0375b4b382e1a842fafe40d7858b7ab4796ec3a67c518d31112b # ggignore
api_entreprise: api_entreprise:
key: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ik9oIHllYWgiLCJpYXQiOjE1MTYyMzkwMjJ9.f06sBo3q2Yxnw_TYPFUEs0CozBmcV-XniH_DeKNWzKE" key: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ik9oIHllYWgiLCJpYXQiOjE1MTYyMzkwMjJ9.f06sBo3q2Yxnw_TYPFUEs0CozBmcV-XniH_DeKNWzKE" # ggignore
pipedrive: pipedrive:
key: pipedrive_test_key key: pipedrive_test_key
france_connect_particulier: france_connect_particulier:

View file

@ -1,7 +1,7 @@
namespace :after_party do namespace :after_party do
desc 'Deployment task: backfill_experts_procedure_id_on_avis_table' desc 'Deployment task: backfill_experts_procedure_id_on_avis_table'
task backfill_experts_procedure_id_on_avis_table: :environment do task backfill_experts_procedure_id_on_avis_table_again: :environment do
puts "Running deploy task 'backfill_experts_procedure_id_on_avis_table'" puts "Running deploy task 'backfill_experts_procedure_id_on_avis_table_again'"
without_instructeur = Avis.where(experts_procedure_id: nil, instructeur_id: nil).where.not(email: nil) without_instructeur = Avis.where(experts_procedure_id: nil, instructeur_id: nil).where.not(email: nil)
with_instructeur = Avis.where(experts_procedure_id: nil, email: nil).where.not(instructeur_id: nil) with_instructeur = Avis.where(experts_procedure_id: nil, email: nil).where.not(instructeur_id: nil)

View file

@ -5,6 +5,9 @@ namespace :after_party do
BATCH_SIZE = 20_000 BATCH_SIZE = 20_000
ignored_columns = Dossier.ignored_columns.dup
Dossier.ignored_columns -= ["en_construction_conservation_extension"]
dossiers = Dossier.state_en_construction.where.not(en_construction_conservation_extension: 0.days) dossiers = Dossier.state_en_construction.where.not(en_construction_conservation_extension: 0.days)
progress = ProgressReport.new((dossiers.count.to_f / BATCH_SIZE).round) progress = ProgressReport.new((dossiers.count.to_f / BATCH_SIZE).round)
dossiers.in_batches(of: BATCH_SIZE) do |relation| dossiers.in_batches(of: BATCH_SIZE) do |relation|
@ -13,6 +16,8 @@ namespace :after_party do
end end
progress.finish progress.finish
Dossier.ignored_columns = ignored_columns
dossiers_without_conservation_extension = Dossier.where(conservation_extension: nil) dossiers_without_conservation_extension = Dossier.where(conservation_extension: nil)
progress = ProgressReport.new((dossiers_without_conservation_extension.count.to_f / BATCH_SIZE).round) progress = ProgressReport.new((dossiers_without_conservation_extension.count.to_f / BATCH_SIZE).round)
dossiers_without_conservation_extension.in_batches(of: BATCH_SIZE) do |relation| dossiers_without_conservation_extension.in_batches(of: BATCH_SIZE) do |relation|

View file

@ -164,7 +164,7 @@ describe Administrateurs::GroupeInstructeursController, type: :controller do
it { expect(gi_1_2.dossiers.with_discarded.count).to be(2) } it { expect(gi_1_2.dossiers.with_discarded.count).to be(2) }
it { expect(gi_1_2.dossiers.last.id).to be(dossier12.id) } it { expect(gi_1_2.dossiers.last.id).to be(dossier12.id) }
it { expect(dossier12.groupe_instructeur.id).to be(gi_1_2.id) } it { expect(dossier12.groupe_instructeur.id).to be(gi_1_2.id) }
it { expect(bulk_message.groupe_instructeurs).to eq([gi_1_2, gi_1_3]) } it { expect(bulk_message.groupe_instructeurs).to contain_exactly(gi_1_2, gi_1_3) }
end end
describe 'when the target group is not a possible group' do describe 'when the target group is not a possible group' do

View file

@ -149,6 +149,7 @@ describe FranceConnect::ParticulierController, type: :controller do
RSpec.shared_examples "a method that needs a valid merge token" do RSpec.shared_examples "a method that needs a valid merge token" do
context 'when the merge token is invalid' do context 'when the merge token is invalid' do
before do before do
stub_const("APPLICATION_NAME", "demarches-simplifiees.fr")
merge_token merge_token
fci.update(merge_token_created_at: 2.years.ago) fci.update(merge_token_created_at: 2.years.ago)
end end
@ -181,6 +182,10 @@ describe FranceConnect::ParticulierController, type: :controller do
context 'when the merge token does not exist' do context 'when the merge token does not exist' do
let(:merge_token) { 'i do not exist' } let(:merge_token) { 'i do not exist' }
before do
stub_const("APPLICATION_NAME", "demarches-simplifiees.fr")
end
it do it do
expect(subject).to redirect_to root_path expect(subject).to redirect_to root_path
expect(flash.alert).to eq("Le délai pour fusionner les comptes FranceConnect et demarches-simplifiees.fr est expirée. Veuillez recommencer la procédure pour vous fusionner les comptes.") expect(flash.alert).to eq("Le délai pour fusionner les comptes FranceConnect et demarches-simplifiees.fr est expirée. Veuillez recommencer la procédure pour vous fusionner les comptes.")

View file

@ -0,0 +1,22 @@
RSpec.describe Cron::PurgeManagerAdministrateurSessionsJob, type: :job do
describe 'perform' do
let(:administrateur) { create(:administrateur) }
let(:procedure) { create(:procedure) }
subject { Cron::PurgeManagerAdministrateurSessionsJob.perform_now }
context "with an inactive administrateur" do
before do
AdministrateursProcedure.create(procedure: procedure, administrateur: administrateur, manager: true)
expect(AdministrateursProcedure.where(manager: true).count).to eq(1)
expect(AdministrateursProcedure.count).to eq(2)
subject
end
it {
expect(AdministrateursProcedure.where(manager: true).count).to eq(0)
expect(AdministrateursProcedure.count).to eq(1)
}
end
end
end

View file

@ -10,6 +10,10 @@ describe 'Inviting an expert:', js: true do
let(:dossier) { create(:dossier, :en_construction, :with_dossier_link, procedure: procedure) } let(:dossier) { create(:dossier, :en_construction, :with_dossier_link, procedure: procedure) }
let(:linked_dossier) { Dossier.find_by(id: dossier.reload.champs.filter(&:dossier_link?).filter_map(&:value)) } let(:linked_dossier) { Dossier.find_by(id: dossier.reload.champs.filter(&:dossier_link?).filter_map(&:value)) }
before do
clear_emails
end
context 'as an Instructeur' do context 'as an Instructeur' do
scenario 'I can invite an expert' do scenario 'I can invite an expert' do
allow(ClamavService).to receive(:safe_file?).and_return(true) allow(ClamavService).to receive(:safe_file?).and_return(true)