fix(entreprise): don't leak identity of non diffusable etablissement

This commit is contained in:
Colin Darie 2023-11-23 16:21:44 +01:00
parent 61654d65a2
commit aa84a4c335
2 changed files with 14 additions and 6 deletions

View file

@ -109,13 +109,15 @@ module DossierHelper
def demandeur_dossier(dossier)
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
if dossier.etablissement.present?
raison_sociale_or_name(dossier.etablissement)
else
""
end
raison_sociale_or_name(dossier.etablissement)
end
end

View file

@ -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