dossier: add a notice when some attachments of the dossier were lost

On the 22/01/2020, a technical error on the demarches-simplifees.fr
instance made us delete some files attached to some dossiers.

This PR adds a warning when browsing a dossier containing attachments
that were deleted.
This commit is contained in:
Pierre de La Morinerie 2020-01-27 13:28:23 +00:00
parent 7c60b9dfa8
commit 7ba76c6658
7 changed files with 1061 additions and 12 deletions

View file

@ -46,6 +46,18 @@
} }
} }
ul {
list-style-type: disc;
list-style-position: inside;
padding-left: $default-padding;
}
ol {
list-style-type: decimal;
list-style-position: inside;
padding-left: $default-padding;
}
p:not(:last-of-type) { p:not(:last-of-type) {
margin-bottom: $default-spacer; margin-bottom: $default-spacer;
} }

View file

@ -69,4 +69,27 @@ module DossierHelper
dossier.state dossier.state
end end
end end
# On the 22/01/2020, a technical error on the demarches-simplifees.fr
# instance caused some files attached to some dossiers to be deleted.
#
# This method returns true if the dossier contained attachments
# whose files were deleted during this incident.
def has_lost_attachments(dossier)
if dinum_instance?
dossiers_with_lost_attachments_ids.include?(dossier.id)
else
false
end
end
private
def dinum_instance?
ENV['APP_HOST']&.ends_with?('demarches-simplifiees.fr')
end
def dossiers_with_lost_attachments_ids
@@ids ||= YAML.load_file(Rails.root.join('config', 'dossiers-with-lost-attachments.yml'))
end
end end

View file

@ -24,5 +24,7 @@
.tab-title Formulaire .tab-title Formulaire
- champs = dossier.champs.includes(:type_de_champ) - champs = dossier.champs.includes(:type_de_champ)
- if champs.any? || dossier.procedure.routee? - if champs.any? || dossier.procedure.routee?
- if has_lost_attachments(dossier)
= render partial: "shared/dossiers/lost_attachments", locals: { dossier: dossier }
.card .card
= render partial: "shared/dossiers/champs", locals: { champs: champs, dossier: dossier, demande_seen_at: demande_seen_at, profile: profile } = render partial: "shared/dossiers/champs", locals: { champs: champs, dossier: dossier, demande_seen_at: demande_seen_at, profile: profile }

View file

@ -0,0 +1,27 @@
/# FIXME: add a specific wording for Usagers
.card.warning
.card-title Des pièces jointes de ce dossier peuvent être manquantes.
%p
Suite à un incident survenu le 21 janvier, demarche-simplifiees.fr a perdu par erreur une partie des pièces jointes de ce dossier.
- if dossier.en_construction?
%p
Si une ou plusieurs pièces jointes manquent, nous vous invitons à
= succeed ',' do
= link_to 'contacter le demandeur', messagerie_instructeur_dossier_path(dossier.procedure, dossier)
pour lui demander de
= succeed '.' do
%strong renvoyer les pièces jointes nécessaires
- else
%p
Si une ou plusieurs pièces jointes essentielles manquent, nous vous invitons à :
%ol
%li repasser ce dossier en construction ;
%li<
= link_to 'contacter le demandeur ', messagerie_instructeur_dossier_path(dossier.procedure, dossier)
pour lui demander de
= succeed '.' do
%strong renvoyer les pièces jointes nécessaires
%p Le demandeur de ce dossier a également été prévenu. Nous nous excusons pour la gêne occasionnée.

View file

@ -0,0 +1,946 @@
# On the 22/01/2020, a technical error on the demarches-simplifees.fr
# instance made us delete some files attached to some dossiers.
#
# This list contains the ids of all dossiers where some attached
# file was mistakenly deleted during this incident.
- 22
- 9224
- 9244
- 9489
- 9495
- 11045
- 14311
- 14530
- 14553
- 14569
- 14616
- 14619
- 15325
- 15331
- 16448
- 17848
- 18190
- 18308
- 18855
- 18929
- 18946
- 18965
- 19284
- 19697
- 19698
- 19872
- 20334
- 20663
- 20931
- 21015
- 21024
- 21620
- 21753
- 21782
- 21865
- 21871
- 21876
- 21938
- 21963
- 21971
- 22011
- 22042
- 22045
- 22063
- 22068
- 22108
- 22279
- 22434
- 22488
- 22523
- 24277
- 25275
- 26223
- 26228
- 27069
- 27213
- 29366
- 29386
- 29486
- 31179
- 31983
- 32004
- 32323
- 32325
- 32492
- 32497
- 35072
- 35074
- 35193
- 35232
- 35308
- 35323
- 35357
- 35442
- 35486
- 35496
- 35554
- 35644
- 36659
- 38984
- 39026
- 39099
- 39158
- 39287
- 39314
- 39352
- 39359
- 39371
- 39380
- 39390
- 39403
- 39493
- 39526
- 41106
- 41111
- 43566
- 43570
- 43571
- 43572
- 43578
- 43741
- 43785
- 43791
- 43884
- 43928
- 43935
- 43937
- 44013
- 44035
- 45123
- 48500
- 48690
- 52921
- 53029
- 53067
- 53097
- 53118
- 53147
- 53152
- 53153
- 53154
- 53155
- 53159
- 53171
- 53176
- 53178
- 53207
- 53208
- 53218
- 53472
- 53981
- 54002
- 56253
- 57216
- 57689
- 58003
- 58411
- 58721
- 59445
- 59925
- 61917
- 62547
- 62551
- 62552
- 62956
- 63035
- 63607
- 63615
- 65154
- 66268
- 66379
- 66963
- 67066
- 68688
- 68705
- 68710
- 68737
- 68929
- 68943
- 69023
- 69026
- 69510
- 69521
- 69546
- 70148
- 70224
- 72653
- 76114
- 79303
- 79863
- 79929
- 79951
- 79976
- 80032
- 84640
- 93404
- 98647
- 99294
- 101868
- 103748
- 104097
- 107096
- 109146
- 113137,
- 113690
- 113707
- 113711
- 113722
- 113743
- 117270
- 118003
- 119395
- 120824
- 121498
- 124009
- 125430
- 127024
- 130735
- 132389
- 132942
- 133317
- 133697
- 137347
- 137374
- 137427
- 137525
- 137900
- 138272
- 138436
- 138466
- 138515
- 138550
- 138631
- 138703
- 138990
- 139296
- 139371
- 140604
- 140811
- 141142
- 141227
- 148609
- 153917
- 156644
- 157401
- 184400
- 190035
- 191350
- 193213
- 193783
- 194088
- 198497
- 200002
- 200005
- 200017
- 200041
- 200048
- 200060
- 200061
- 200062
- 200081
- 200086
- 200089
- 200094
- 200098
- 200100
- 200108
- 200109
- 200113
- 200128
- 200138
- 200140
- 200143
- 200154
- 200158
- 200161
- 200163
- 200169
- 200182
- 200186
- 200195
- 200202
- 200208
- 200211
- 200263
- 200267
- 200448
- 200685
- 200757
- 200784
- 200787
- 201021
- 201315
- 201576
- 201921
- 201986
- 202015
- 203553
- 203630
- 204737
- 204866
- 204924
- 204982
- 205021
- 205265
- 205424
- 205655
- 205659
- 205847
- 205940
- 205954
- 205987
- 206013
- 206089
- 206108
- 206170
- 206179
- 206217
- 206237
- 206285
- 206288
- 206290
- 206300
- 206374
- 206472
- 206490
- 206494
- 206515
- 206532
- 206589
- 206612
- 206734
- 206741
- 206782
- 206807
- 206828
- 206835
- 206856
- 206887
- 206904
- 206909
- 206913
- 206931
- 206964
- 206972
- 206977
- 206979
- 206992
- 207004
- 207006
- 207032
- 207061
- 207078
- 207103
- 207104
- 207118
- 207181
- 207183
- 207197
- 207207
- 207236
- 207537
- 207734
- 207773
- 208009
- 208153
- 208186
- 208199
- 208379
- 208422
- 208545
- 208549
- 208873
- 208903
- 209151
- 209392
- 209397
- 209873
- 210103
- 210175
- 210959
- 211018
- 211144
- 211197
- 211852
- 212322
- 212359
- 212493
- 212503
- 212955
- 212986
- 213596
- 213598
- 213612
- 213625
- 213694
- 213712
- 213749
- 214123
- 214592
- 215503
- 215510
- 215742
- 215756
- 216263
- 216360
- 216620
- 217131
- 217159
- 217215
- 217320
- 217361
- 217373
- 217487
- 217507
- 217518
- 217587
- 217677
- 217714
- 217790
- 217796
- 217850
- 217859
- 217871
- 217875
- 218370
- 218419
- 219341
- 220675
- 221967
- 222266
- 222801
- 222868
- 222875
- 222946
- 222949
- 222965
- 223154
- 223303
- 223329
- 223368
- 224064
- 224290
- 225117
- 227153
- 227161
- 227816
- 227931
- 228074
- 228666
- 228703
- 228776
- 228918
- 228926
- 229050
- 229086
- 229109
- 229114
- 229553
- 230338
- 230353
- 230479
- 230539
- 230574
- 230582
- 231261
- 232521
- 232740
- 232916
- 232934
- 232958
- 233008
- 233047
- 233160
- 233197
- 233211
- 233556
- 233605
- 233712
- 235322
- 236625
- 237371
- 237439
- 237605
- 238276
- 239412
- 239500
- 239603
- 239777
- 239805
- 239829
- 239850
- 239858
- 241496
- 241557
- 241598
- 241788
- 241824
- 241858
- 241879
- 241910
- 241927
- 241934
- 241936
- 241939
- 241950
- 241952
- 241955
- 241956
- 241959
- 241969
- 241970
- 241985
- 241987
- 241991
- 241996
- 242414
- 242725
- 242800
- 242808
- 242814
- 242820
- 242840
- 242845
- 242937
- 242942
- 242972
- 242973
- 242975
- 242997
- 243133
- 243234
- 243237
- 243240
- 243273
- 243290
- 243335
- 243339
- 243429
- 245309
- 245460
- 247557
- 248202
- 248537
- 248567
- 248592
- 248726
- 248776
- 249018
- 249342
- 249352
- 249563
- 250149
- 250471
- 250489
- 250502
- 250504
- 250509
- 250511
- 250530
- 251386
- 252994
- 254055
- 254211
- 254972
- 255013
- 255078
- 255082
- 255329
- 255925
- 255990
- 256083
- 256084
- 256296
- 256472
- 257228
- 258640
- 258982
- 259131
- 259147
- 259204
- 261038
- 261117
- 261118
- 261170
- 261452
- 263654
- 264489
- 265036
- 265333
- 265983
- 266034
- 266057
- 266062
- 266069
- 266071
- 266205
- 267145
- 267322
- 267404
- 267708
- 268223
- 268652
- 268654
- 268678
- 268728
- 268731
- 268764
- 268885
- 269421
- 269444
- 269518
- 269560
- 269574
- 269575
- 270213
- 272346
- 272891
- 273169
- 274183
- 274478
- 274634
- 274730
- 275900
- 279329
- 279348
- 280975
- 281779
- 281804
- 282877
- 283362
- 283378
- 283392
- 283395
- 283495
- 283845
- 284616
- 284622
- 284675
- 284687
- 284774
- 284838
- 284880
- 285060
- 285230
- 285575
- 285603
- 287488
- 288210
- 289529
- 289530
- 289811
- 289844
- 289859
- 290754
- 291018
- 291621
- 293625
- 293634
- 296214
- 298172
- 298355
- 298942
- 299000
- 306186
- 310318
- 310544
- 310730
- 311019
- 311728
- 312509
- 312531
- 313699
- 330729
- 337282
- 344150
- 351128
- 360286
- 374944
- 386682
- 386850
- 409245
- 410749
- 429085
- 453060
- 473146
- 473183
- 477625
- 482733
- 485936
- 486996
- 501423
- 524299
- 525738
- 525916
- 525932
- 525936
- 529745
- 529870
- 542902
- 546362
- 546394
- 546406
- 546416
- 546519
- 551264
- 551276
- 552058
- 555081
- 571316
- 574190
- 574209
- 591896
- 600483
- 600501
- 600863
- 601157
- 619683
- 620774
- 627219
- 628388
- 628633
- 628675
- 628701
- 628743
- 628746
- 628763
- 631292
- 635784
- 639656
- 640229
- 642227
- 654699
- 656113
- 665439
- 666028
- 666790
- 670294
- 671241
- 671245
- 671259
- 671268
- 671458
- 677528
- 679414
- 690281
- 690749
- 692168
- 695653
- 695727
- 695768
- 695791
- 696013
- 696428
- 715997
- 719236
- 726969
- 726981
- 727014
- 727551
- 756386
- 756402
- 762500
- 766726
- 767963
- 771492
- 773982
- 775235
- 777837
- 780557
- 781158
- 781502
- 781503
- 784077
- 784298
- 784403
- 792304
- 794024
- 794606
- 795345
- 796814
- 798434
- 798893
- 799196
- 799200
- 800093
- 802666
- 802679
- 802707
- 802709
- 802716
- 808711
- 808740
- 808742
- 808766
- 808767
- 808784
- 808797
- 808876
- 808926
- 808935
- 808937
- 808939
- 808940
- 808943
- 808947
- 808958
- 808963
- 808967
- 808982
- 808983
- 808994
- 809002
- 809004
- 809007
- 811190
- 818427
- 818724
- 819171
- 819725
- 828064
- 828292
- 828535
- 828577
- 828607
- 828641
- 828705
- 828741
- 828778
- 828782
- 828788
- 828819
- 829128
- 829239
- 832186
- 839927
- 841809
- 842330
- 845358
- 846642
- 853954
- 855891
- 859844
- 860016
- 860043
- 860050
- 860059
- 860062
- 860067
- 860520
- 860555
- 861195
- 861222
- 863696
- 888447
- 898772
- 910362
- 916218
- 920528
- 924844
- 931770
- 933988
- 934004
- 934005
- 934008
- 934009
- 934010
- 934013
- 934014
- 934019
- 934029
- 934033
- 934046
- 934058
- 934060
- 938750
- 946941
- 949162
- 951110
- 951227
- 955534
- 959860
- 960038
- 962441
- 962443
- 962515
- 962547
- 962560
- 962664
- 963634
- 966627
- 969062
- 985102
- 990079
- 990281
- 991542
- 999193
- 1009535
- 1016896
- 1018675
- 1019395
- 1020295
- 1020509
- 1020960
- 1020969
- 1020982
- 1021109
- 1023811
- 1027181
- 1028190
- 1035967
- 1036338
- 1038182
- 1047230
- 1048403
- 1048429
- 1048938
- 1049968
- 1050075
- 1063901
- 1063941
- 1063942
- 1079027
- 1079344
- 1083246
- 1086139
- 1088337
- 1092801
- 1102942
- 1110614
- 1110620
- 1112775
- 1116822
- 1121711
- 1140138
- 1143324
- 1145406
- 1153823
- 1157409
- 1164993
- 1165566
- 1168238
- 1169529
- 1174555
- 1182043
- 1184647
- 1187042
- 1188538
- 1206673
- 1206824
- 1206939
- 1206954
- 1206967
- 1206969
- 1249330
- 1249377
- 1249815
- 1263647
- 1279054
- 1280300
- 1280341

View file

@ -183,4 +183,33 @@ RSpec.describe DossierHelper, type: :helper do
it { is_expected.to eq('without_continuation') } it { is_expected.to eq('without_continuation') }
end end
end end
describe '.has_lost_attachments' do
let(:procedure) { create(:procedure, :published) }
let(:dossier_with_lost_attachments) { create(:dossier, procedure: procedure) }
let(:dossier_without_lost_attachments) { create(:dossier, procedure: procedure) }
before do
expect(ENV).to receive(:[]).with('APP_HOST').at_least(:once).and_return(app_host)
allow(helper).to receive(:dossiers_with_lost_attachments_ids).and_return([dossier_with_lost_attachments.id])
end
context 'on the DINUM instance' do
let(:app_host) { 'demarches-simplifiees.fr' }
it 'returns true for dossiers that lost attachments' do
expect(helper.has_lost_attachments(dossier_with_lost_attachments)).to be(true)
expect(helper.has_lost_attachments(dossier_without_lost_attachments)).to be(false)
end
end
context 'on another instance' do
let(:app_host) { 'polynesie-francaise.pref.gouv.fr' }
it 'returns false for all dossiers' do
expect(helper.has_lost_attachments(dossier_with_lost_attachments)).to be(false)
expect(helper.has_lost_attachments(dossier_without_lost_attachments)).to be(false)
end
end
end
end end

View file

@ -9,24 +9,24 @@ describe 'shared/dossiers/demande.html.haml', type: :view do
sign_in(current_instructeur.user) sign_in(current_instructeur.user)
end end
subject! { render 'shared/dossiers/demande.html.haml', dossier: dossier, demande_seen_at: nil, profile: 'usager' } subject { render 'shared/dossiers/demande.html.haml', dossier: dossier, demande_seen_at: nil, profile: 'usager' }
context 'when dossier was created by an etablissement' do context 'when dossier was created by an etablissement' do
let(:etablissement) { create(:etablissement) } let(:etablissement) { create(:etablissement) }
it 'renders the etablissement infos' do it 'renders the etablissement infos' do
expect(rendered).to include(etablissement.entreprise_raison_sociale) expect(subject).to include(etablissement.entreprise_raison_sociale)
expect(rendered).to include(etablissement.entreprise_siret_siege_social) expect(subject).to include(etablissement.entreprise_siret_siege_social)
expect(rendered).to include(etablissement.entreprise_forme_juridique) expect(subject).to include(etablissement.entreprise_forme_juridique)
end end
context 'and entreprise is an association' do context 'and entreprise is an association' do
let(:etablissement) { create(:etablissement, :is_association) } let(:etablissement) { create(:etablissement, :is_association) }
it 'renders the association infos' do it 'renders the association infos' do
expect(rendered).to include(etablissement.association_rna) expect(subject).to include(etablissement.association_rna)
expect(rendered).to include(etablissement.association_titre) expect(subject).to include(etablissement.association_titre)
expect(rendered).to include(etablissement.association_objet) expect(subject).to include(etablissement.association_objet)
end end
end end
end end
@ -35,10 +35,10 @@ describe 'shared/dossiers/demande.html.haml', type: :view do
let(:individual) { create(:individual) } let(:individual) { create(:individual) }
it 'renders the individual identity infos' do it 'renders the individual identity infos' do
expect(rendered).to include(individual.gender) expect(subject).to include(individual.gender)
expect(rendered).to include(individual.nom) expect(subject).to include(individual.nom)
expect(rendered).to include(individual.prenom) expect(subject).to include(individual.prenom)
expect(rendered).to include(I18n.l(individual.birthdate)) expect(subject).to include(I18n.l(individual.birthdate))
end end
end end
@ -47,7 +47,17 @@ describe 'shared/dossiers/demande.html.haml', type: :view do
it 'renders the champs' do it 'renders the champs' do
dossier.champs.each do |champ| dossier.champs.each do |champ|
expect(rendered).to include(champ.libelle) expect(subject).to include(champ.libelle)
end
end
context 'when the dossier lost some attachments' do
before do
expect(view).to receive(:has_lost_attachments).and_return(true)
end
it 'displays a warning message' do
expect(subject).to include('Des pièces jointes de votre dossier peuvent être manquantes.')
end end
end end
end end