diff --git a/app/helpers/avis_helper.rb b/app/helpers/avis_helper.rb new file mode 100644 index 000000000..f9afdc76d --- /dev/null +++ b/app/helpers/avis_helper.rb @@ -0,0 +1,5 @@ +module AvisHelper + def safe_claimant_email(claimant) + claimant&.email || "inconnu" + end +end diff --git a/app/views/experts/avis/instruction.html.haml b/app/views/experts/avis/instruction.html.haml index 9e904d26b..4fd0e2205 100644 --- a/app/views/experts/avis/instruction.html.haml +++ b/app/views/experts/avis/instruction.html.haml @@ -7,7 +7,7 @@ %h1.tab-title Donner votre avis %h2.claimant Demandeur : - %span.email= @avis.claimant.email + %span.email= safe_claimant_email(@avis.claimant) %span.date Demande d’avis envoyée le #{l(@avis.created_at, format: '%d/%m/%y')} %p.introduction= @avis.introduction diff --git a/app/views/experts/shared/avis/_list.html.haml b/app/views/experts/shared/avis/_list.html.haml index 256c857ee..34c5d7ad6 100644 --- a/app/views/experts/shared/avis/_list.html.haml +++ b/app/views/experts/shared/avis/_list.html.haml @@ -9,7 +9,7 @@ .width-100 %h2.claimant = "#{t('claimant', scope: 'activerecord.attributes.avis')} :" - %span.email= (avis.claimant.email == current_expert.email) ? 'Vous' : avis.claimant.email + %span.email= (safe_claimant_email(avis.claimant) == current_expert.email) ? 'Vous' : safe_claimant_email(avis.claimant) - if avis.confidentiel? %span.confidentiel = t('confidentiel', scope: 'activerecord.attributes.avis')