diff --git a/app/controllers/users/dossiers_controller.rb b/app/controllers/users/dossiers_controller.rb index cfba65dde..709730e0f 100644 --- a/app/controllers/users/dossiers_controller.rb +++ b/app/controllers/users/dossiers_controller.rb @@ -536,7 +536,7 @@ module Users Dossier.visible_by_user.or(Dossier.for_procedure_preview).or(Dossier.for_editing_fork) elsif action_name == 'restore' Dossier.hidden_by_user - elsif action_name == 'extend_conservation_and_restore' + elsif action_name == 'extend_conservation_and_restore' || (action_name == 'show' && request.format.pdf?) Dossier.visible_by_user.or(Dossier.hidden_by_expired) else Dossier.visible_by_user diff --git a/spec/system/users/list_dossiers_spec.rb b/spec/system/users/list_dossiers_spec.rb index 116598c05..dd514b931 100644 --- a/spec/system/users/list_dossiers_spec.rb +++ b/spec/system/users/list_dossiers_spec.rb @@ -246,6 +246,14 @@ describe 'user access to the list of their dossiers', js: true do expect(page).to have_content('2 supprimés récemment') end end + + context 'when user download PDF of expired' do + scenario "generate PDF" do + click_on "3 supprimés récemment" + click_on 'Télécharger mon dossier', match: :first + # Test fails when an error happens during PDF generation + end + end end describe "user search bar" do