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
|
%h1.tab-title Donner votre avis
|
||||||
%h2.claimant
|
%h2.claimant
|
||||||
Demandeur :
|
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')}
|
%span.date Demande d’avis envoyée le #{l(@avis.created_at, format: '%d/%m/%y')}
|
||||||
%p.introduction= @avis.introduction
|
%p.introduction= @avis.introduction
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
.width-100
|
.width-100
|
||||||
%h2.claimant
|
%h2.claimant
|
||||||
= "#{t('claimant', scope: 'activerecord.attributes.avis')} :"
|
= "#{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?
|
- if avis.confidentiel?
|
||||||
%span.confidentiel
|
%span.confidentiel
|
||||||
= t('confidentiel', scope: 'activerecord.attributes.avis')
|
= t('confidentiel', scope: 'activerecord.attributes.avis')
|
||||||
|
|
Loading…
Reference in a new issue