Merge pull request #7303 from betagouv/sentry/3267070633

bug(commencer#commencer): raise when procedure does not have a service
This commit is contained in:
mfo 2022-05-12 16:47:43 +02:00 committed by GitHub
commit b793ef0ff8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 4 deletions

View file

@ -70,7 +70,9 @@ module Users
procedure = Procedure.find_by(path: params[:path])
if procedure&.close?
flash.alert = t('errors.messages.procedure_archived', service_name: procedure.service.nom, service_phone_number: procedure.service.telephone, service_email: procedure.service.email)
flash.alert = procedure.service.presence ?
t('errors.messages.procedure_archived.with_service_and_phone_email', service_phone_number: procedure.service.telephone, service_email: procedure.service.email) :
t('errors.messages.procedure_archived.with_organisation_only', organisation_name: procedure.organisation_name)
else
flash.alert = t('errors.messages.procedure_not_found')
end

View file

@ -7,7 +7,6 @@
= t('pluralize.dossier_trouve', count: @dossiers_count)
= pagination
- if @projected_dossiers.present?
%table.table.dossiers-table.hoverable
%thead

View file

@ -359,7 +359,9 @@ en:
# # etablissement_fail: 'Désolé, nous navons pas réussi à enregistrer létablissement correspondant à ce numéro SIRET'
france_connect:
connexion: "Error trying to connect to France Connect."
procedure_archived: This procedure has been closed, it is no longer possible to submit a file. For more information, please contact the service %{service_name}, available at %{service_phone_number} or by email %{service_email}
procedure_archived:
with_service_and_phone_email: This procedure has been closed, it is no longer possible to submit a file. For more information, please contact the service %{service_name}, available at %{service_phone_number} or by email %{service_email}
with_organisation_only: This procedure has been closed, it is no longer possible to submit a file. For more information, please contact the organisation %{organisation_name}
# # procedure_not_draft: "This procedure is not a draft anymore."
# cadastres_empty:
# one: "Aucune parcelle cadastrale sur la zone sélectionnée"

View file

@ -364,7 +364,10 @@ fr:
france_connect:
connexion: "Erreur lors de la connexion à France Connect."
forbidden_html: "Seul-e-s les usagers peuvent se connecter via France Connect. En tant quinstructeur ou administrateur, nous vous invitons à <a href='%{reset_link}'>réininitialiser votre mot de passe</a>."
procedure_archived: Cette démarche en ligne a été close, il nest plus possible de déposer de dossier. Pour plus d'informations veuillez contacter le service %{service_name} au %{service_phone_number} ou par email à %{service_email}
procedure_archived:
with_service_and_phone_email: Cette démarche en ligne a été close, il nest plus possible de déposer de dossier. Pour plus d'informations veuillez contacter le service %{service_name} au %{service_phone_number} ou par email à %{service_email}
with_organisation_only: Cette démarche en ligne a été close, il nest plus possible de déposer de dossier. Pour plus d'informations veuillez contacter le service %{organisation_name}
empty_repetition: '« %{value} » doit comporter au moins un champ répétable'
empty_drop_down: '« %{value} » doit comporter au moins un choix sélectionnable'
# procedure_not_draft: "Cette démarche nest maintenant plus en brouillon."

View file

@ -32,6 +32,14 @@ describe Users::CommencerController, type: :controller do
expect(subject).to redirect_to(root_path)
end
end
context 'when procedure is closed' do
it 'works' do
published_procedure.close!
get :commencer, params: { path: published_procedure.path }
expect(response).to redirect_to(root_path)
end
end
end
describe '#commencer_test' do