Skip to content

Commit c359186

Browse files
committed
fix(siret): stop showing a redundant warning message on technical_error
For a SIRET champ, the non-blocking technical_error banner (added below the input) and this component's own external_error warning were both rendered at once, contradicting each other visually (blue info + red warning for the same non-blocking state). The warning branch is unreachable for :not_found (validation errors take precedence in the template) and now redundant for :technical_error, so it's removed along with its now-unused translations.
1 parent b0e10df commit c359186

4 files changed

Lines changed: 15 additions & 4 deletions

File tree

app/components/dsfr/input_status_message_component.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,6 @@ def statut_message
6060
{ state: :info, text: t('.siret.fetched_with_capital', raison_sociale_or_name: displayable_raison_sociale_or_name(@champ.etablissement), forme_juridique: @champ.etablissement.entreprise_forme_juridique, capital_sociale: pretty_currency(@champ.etablissement.entreprise_capital_social)) }
6161
elsif @champ.etablissement && @champ.etablissement.entreprise_capital_social.blank?
6262
{ state: :info, text: t('.siret.fetched', raison_sociale_or_name: displayable_raison_sociale_or_name(@champ.etablissement), forme_juridique: @champ.etablissement.entreprise_forme_juridique) }
63-
elsif @champ.external_error?
64-
{ state: :warning, text: t('.siret.error', value: pretty_siret(@champ.external_id)) }
6563
elsif @champ.pending?
6664
{ state: :info, text: t('.siret.pending', value: pretty_siret(@champ.external_id)) }
6765
end

app/components/dsfr/input_status_message_component/input_status_message_component.en.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ en:
88
pending: "Search in progress for SIRET %{value}…"
99
fetched_with_capital: "%{raison_sociale_or_name} %{forme_juridique} with a share capital of %{capital_sociale}"
1010
fetched: "%{raison_sociale_or_name} %{forme_juridique}"
11-
error: "An error occurred while retrieving SIRET information."
1211
referentiel:
1312
not_configured: "This field has not been configured by the administrator yet."
1413
fetching: "Search in progress."

app/components/dsfr/input_status_message_component/input_status_message_component.fr.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ fr:
88
pending: "Recherche en cours pour le SIRET %{value}…"
99
fetched_with_capital: "%{raison_sociale_or_name} %{forme_juridique} au capital social de %{capital_sociale}"
1010
fetched: "%{raison_sociale_or_name} %{forme_juridique}"
11-
error: "Une erreur est survenue lors de la récupération des informations SIRET."
1211
referentiel:
1312
not_configured: "Ce champ n’est pas encore configuré par l’administrateur."
1413
fetching: "Recherche en cours."

spec/components/input_status_message_component_spec.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,21 @@
240240
end
241241
end
242242

243+
context "when external fetch failed with a technical error (non-blocking)" do
244+
before do
245+
champ.update!(etablissement: nil)
246+
champ.update_columns(
247+
external_id: '80879023200025',
248+
external_state: 'external_error',
249+
fetch_external_data_exceptions: [ExternalDataException.new(error: 'API down', code: 503, kind: :technical_error)]
250+
)
251+
end
252+
253+
it "does not render a warning message (the non-blocking info banner already covers it)" do
254+
expect(subject).not_to have_css(".fr-message--warning")
255+
end
256+
end
257+
243258
context "when etablissement is non-diffusible (diffusable_commercialement: false)" do
244259
before do
245260
etablissement = create(:etablissement, :non_diffusable, entreprise_raison_sociale: "SECRET EI", entreprise_forme_juridique: "Entrepreneur individuel")

0 commit comments

Comments
 (0)