fix(avis#instruction): use safer claiment.email with a simple helper
This commit is contained in:
parent
91f1fa4ffb
commit
25a0daf0a2
3 changed files with 7 additions and 2 deletions
5
app/helpers/avis_helper.rb
Normal file
5
app/helpers/avis_helper.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
module AvisHelper
|
||||
def safe_claimant_email(claimant)
|
||||
claimant&.email || "inconnu"
|
||||
end
|
||||
end
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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')
|
||||
|
|
Loading…
Reference in a new issue