fix(entreprise): don't leak identity of non diffusable etablissement
This commit is contained in:
parent
61654d65a2
commit
aa84a4c335
2 changed files with 14 additions and 6 deletions
|
@ -109,13 +109,15 @@ module DossierHelper
|
|||
|
||||
def demandeur_dossier(dossier)
|
||||
if dossier.procedure.for_individual?
|
||||
"#{dossier&.individual&.nom} #{dossier&.individual&.prenom}"
|
||||
else
|
||||
if dossier.etablissement.present?
|
||||
raison_sociale_or_name(dossier.etablissement)
|
||||
else
|
||||
""
|
||||
return "#{dossier&.individual&.nom} #{dossier&.individual&.prenom}"
|
||||
end
|
||||
|
||||
return "" if dossier.etablissement.blank?
|
||||
|
||||
if dossier.etablissement.diffusable_commercialement == false
|
||||
"SIRET #{pretty_siret(dossier.etablissement.siret)}"
|
||||
else
|
||||
raison_sociale_or_name(dossier.etablissement)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -69,6 +69,12 @@ RSpec.describe DossierHelper, type: :helper do
|
|||
context "when the company has name information" do
|
||||
it { is_expected.to eq raison_sociale_or_name(etablissement) }
|
||||
end
|
||||
|
||||
context "when the company is not diffusable" do
|
||||
let(:etablissement) { build(:etablissement, :non_diffusable, siret: "12345678901234") }
|
||||
|
||||
it { is_expected.to include("123 456 789 01234") }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue