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)
|
def demandeur_dossier(dossier)
|
||||||
if dossier.procedure.for_individual?
|
if dossier.procedure.for_individual?
|
||||||
"#{dossier&.individual&.nom} #{dossier&.individual&.prenom}"
|
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
|
else
|
||||||
if dossier.etablissement.present?
|
raison_sociale_or_name(dossier.etablissement)
|
||||||
raison_sociale_or_name(dossier.etablissement)
|
|
||||||
else
|
|
||||||
""
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -69,6 +69,12 @@ RSpec.describe DossierHelper, type: :helper do
|
||||||
context "when the company has name information" do
|
context "when the company has name information" do
|
||||||
it { is_expected.to eq raison_sociale_or_name(etablissement) }
|
it { is_expected.to eq raison_sociale_or_name(etablissement) }
|
||||||
end
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue