From 3a1523245c9da8a06812d2207381a845a79d8eaa Mon Sep 17 00:00:00 2001 From: Johan Girod Date: Tue, 2 Apr 2024 09:37:12 +0200 Subject: [PATCH 1/2] fix: remove non diffusible document for agent --- .vscode/extensions.json | 1 - .vscode/settings.json | 9 --------- .../alerts-with-explanations/rne-not-found-alert.tsx | 5 ++++- components/etablissement-section/index.tsx | 2 +- components/immatriculations/index.tsx | 5 ++++- components/immatriculations/insee.tsx | 7 ++++++- components/justificatifs/avis-situation-link/index.tsx | 6 ++++-- components/unite-legale-section/index.tsx | 1 + 8 files changed, 20 insertions(+), 16 deletions(-) diff --git a/.vscode/extensions.json b/.vscode/extensions.json index bbaddc5c0..d489b9a15 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -2,7 +2,6 @@ "recommendations": [ "esbenp.prettier-vscode", "dbaeumer.vscode-eslint", - "ban.spellright", "mikestead.dotenv" ] } diff --git a/.vscode/settings.json b/.vscode/settings.json index 0eab71c8e..0a7ae7e58 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,13 +1,4 @@ { - "spellright.language": ["fr", "en"], - "spellright.documentTypes": [ - "yaml", - "git-commit", - "markdown", - "html", - "typescript", - "typescriptreact" - ], "eslint.enable": true, "editor.formatOnSave": true, "editor.codeActionsOnSave": ["source.organizeImports", "source.fixAll.eslint"] diff --git a/components-ui/alerts-with-explanations/rne-not-found-alert.tsx b/components-ui/alerts-with-explanations/rne-not-found-alert.tsx index 4686205cd..e3e6be23c 100644 --- a/components-ui/alerts-with-explanations/rne-not-found-alert.tsx +++ b/components-ui/alerts-with-explanations/rne-not-found-alert.tsx @@ -2,11 +2,13 @@ import ButtonLink from '#components-ui/button'; import { INPI } from '#components/administrations'; import AvisSituationLink from '#components/justificatifs/avis-situation-link'; import { IUniteLegale } from '#models/core/types'; +import { ISession } from '#utils/session'; import { Warning } from '../alerts'; const ImmatriculationRNENotFoundAlert: React.FC<{ uniteLegale: IUniteLegale; -}> = ({ uniteLegale }) => ( + session: ISession | null; +}> = ({ uniteLegale, session }) => ( L’Immatriculation au Registre National des Entreprises (RNE) est @@ -44,6 +46,7 @@ const ImmatriculationRNENotFoundAlert: React.FC<{
En l’absence de justificatif d’immatriculation, vous pouvez télécharger{' '} diff --git a/components/etablissement-section/index.tsx b/components/etablissement-section/index.tsx index d463651c2..1917aa8a0 100644 --- a/components/etablissement-section/index.tsx +++ b/components/etablissement-section/index.tsx @@ -180,7 +180,7 @@ const EtablissementSection: React.FC = ({ : []), [ 'Avis de situation Insee', - , + , ], ]; diff --git a/components/immatriculations/index.tsx b/components/immatriculations/index.tsx index 0aa772f49..c54f15486 100644 --- a/components/immatriculations/index.tsx +++ b/components/immatriculations/index.tsx @@ -61,7 +61,10 @@ const Immatriculations: React.FC = ({ ) : isServicePublic(uniteLegale) ? null : ( <> - +
)} diff --git a/components/immatriculations/insee.tsx b/components/immatriculations/insee.tsx index 5141a4f15..e41d88369 100644 --- a/components/immatriculations/insee.tsx +++ b/components/immatriculations/insee.tsx @@ -34,7 +34,11 @@ const AvisSituationTable: React.FC<{ statutDiffusion={etablissement.statutDiffusion} since={etablissement.dateFermeture} />, - , + , ])} /> ); @@ -78,6 +82,7 @@ const AvisSituationSection: React.FC = ({ uniteLegale, session }) => ( Si vous avez plusieurs établisements et ne savez pas quel avis de situation utiliser,{' '} diff --git a/components/justificatifs/avis-situation-link/index.tsx b/components/justificatifs/avis-situation-link/index.tsx index aa72668f6..e21cfaaf6 100644 --- a/components/justificatifs/avis-situation-link/index.tsx +++ b/components/justificatifs/avis-situation-link/index.tsx @@ -5,12 +5,14 @@ import { nonDiffusibleDataFormatter, } from '#models/core/statut-diffusion'; import { IEtablissement } from '#models/core/types'; +import { ISession, isAgent } from '#utils/session'; const AvisSituationLink: React.FC<{ etablissement: IEtablissement; + session: ISession | null; label?: string; -}> = ({ etablissement, label }) => - estDiffusible(etablissement) ? ( +}> = ({ etablissement, label, session }) => + estDiffusible(etablissement) || isAgent(session) ? ( Avis de situation Insee :{' '} From 43c10e40c15d2f2734fe7114a81ee0a0bbc39ada Mon Sep 17 00:00:00 2001 From: Johan Girod Date: Tue, 2 Apr 2024 09:40:21 +0200 Subject: [PATCH 2/2] fix: remove non diffusible title for agents --- app/(header-default)/entreprise/[slug]/page.tsx | 5 +++-- .../alerts-with-explanations/rne-not-found-alert.tsx | 2 +- .../justificatifs/avis-situation-link/index.tsx | 11 +++++++++-- cypress/e2e/advanced-research.cy.js | 1 - 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/app/(header-default)/entreprise/[slug]/page.tsx b/app/(header-default)/entreprise/[slug]/page.tsx index 2f5dd661d..01e18f980 100644 --- a/app/(header-default)/entreprise/[slug]/page.tsx +++ b/app/(header-default)/entreprise/[slug]/page.tsx @@ -49,9 +49,10 @@ export const generateMetadata = withErrorHandler( const { slug, page, isBot } = extractParamsAppRouter(props); const uniteLegale = await cachedGetUniteLegale(slug, page, isBot); + const session = await getSession(); return { - title: uniteLegalePageTitle(uniteLegale, null), - description: uniteLegalePageDescription(uniteLegale, null), + title: uniteLegalePageTitle(uniteLegale, session), + description: uniteLegalePageDescription(uniteLegale, session), robots: shouldNotIndex(uniteLegale) ? 'noindex, nofollow' : 'index, follow', diff --git a/components-ui/alerts-with-explanations/rne-not-found-alert.tsx b/components-ui/alerts-with-explanations/rne-not-found-alert.tsx index e3e6be23c..41ad84e26 100644 --- a/components-ui/alerts-with-explanations/rne-not-found-alert.tsx +++ b/components-ui/alerts-with-explanations/rne-not-found-alert.tsx @@ -2,7 +2,7 @@ import ButtonLink from '#components-ui/button'; import { INPI } from '#components/administrations'; import AvisSituationLink from '#components/justificatifs/avis-situation-link'; import { IUniteLegale } from '#models/core/types'; -import { ISession } from '#utils/session'; +import { ISession } from '#models/user/session'; import { Warning } from '../alerts'; const ImmatriculationRNENotFoundAlert: React.FC<{ diff --git a/components/justificatifs/avis-situation-link/index.tsx b/components/justificatifs/avis-situation-link/index.tsx index e21cfaaf6..1c53752c7 100644 --- a/components/justificatifs/avis-situation-link/index.tsx +++ b/components/justificatifs/avis-situation-link/index.tsx @@ -1,18 +1,20 @@ import React from 'react'; import routes from '#clients/routes'; +import FAQLink from '#components-ui/faq-link'; import { estDiffusible, nonDiffusibleDataFormatter, } from '#models/core/statut-diffusion'; import { IEtablissement } from '#models/core/types'; -import { ISession, isAgent } from '#utils/session'; +import { EScope, hasRights } from '#models/user/rights'; +import { ISession } from '#models/user/session'; const AvisSituationLink: React.FC<{ etablissement: IEtablissement; session: ISession | null; label?: string; }> = ({ etablissement, label, session }) => - estDiffusible(etablissement) || isAgent(session) ? ( + estDiffusible(etablissement) ? ( {label || 'Avis de situation'} + ) : hasRights(session, EScope.isAgent) ? ( + + L’avis de situation INSEE n’est pas disponible pour les entreprises non + diffusibles, y compris les agents publics. + ) : ( <>{nonDiffusibleDataFormatter('document non-diffusible')} ); diff --git a/cypress/e2e/advanced-research.cy.js b/cypress/e2e/advanced-research.cy.js index 8f3e86ffa..86c11c92c 100644 --- a/cypress/e2e/advanced-research.cy.js +++ b/cypress/e2e/advanced-research.cy.js @@ -17,7 +17,6 @@ describe('Search page', () => { describe('Dirigeants and Elus search', () => { it('Search an élu with dirigeants filters', () => { cy.visit('/rechercher?terme=&fn=anne&n=hidalgo'); - cy.contains('36 RUE DES PIPISRELLES').should('be.visible'); cy.contains('VILLE DE PARIS').should('be.visible'); }); it('Search a dirigeant with main search bar', () => {