Skip to content

Commit

Permalink
Merge pull request #970 from etalab/TMP-johan
Browse files Browse the repository at this point in the history
fix: remove non diffusible document for agent
  • Loading branch information
johangirod committed Apr 9, 2024
2 parents 7ff7149 + 43c10e4 commit 14c2aa8
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 18 deletions.
1 change: 0 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"recommendations": [
"esbenp.prettier-vscode",
"dbaeumer.vscode-eslint",
"ban.spellright",
"mikestead.dotenv"
]
}
9 changes: 0 additions & 9 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -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"]
Expand Down
5 changes: 3 additions & 2 deletions app/(header-default)/entreprise/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 '#models/user/session';
import { Warning } from '../alerts';

const ImmatriculationRNENotFoundAlert: React.FC<{
uniteLegale: IUniteLegale;
}> = ({ uniteLegale }) => (
session: ISession | null;
}> = ({ uniteLegale, session }) => (
<Warning full>
<strong>
L’Immatriculation au Registre National des Entreprises (RNE) est
Expand Down Expand Up @@ -44,6 +46,7 @@ const ImmatriculationRNENotFoundAlert: React.FC<{
<br />
En l’absence de justificatif d’immatriculation, vous pouvez télécharger{' '}
<AvisSituationLink
session={session}
etablissement={uniteLegale.siege}
label="l’avis de situation Insee du siège social"
/>
Expand Down
2 changes: 1 addition & 1 deletion components/etablissement-section/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ const EtablissementSection: React.FC<IProps> = ({
: []),
[
'Avis de situation Insee',
<AvisSituationLink etablissement={etablissement} />,
<AvisSituationLink session={session} etablissement={etablissement} />,
],
];

Expand Down
5 changes: 4 additions & 1 deletion components/immatriculations/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ const Immatriculations: React.FC<IProps> = ({
</>
) : isServicePublic(uniteLegale) ? null : (
<>
<ImmatriculationRNENotFoundAlert uniteLegale={uniteLegale} />
<ImmatriculationRNENotFoundAlert
session={session}
uniteLegale={uniteLegale}
/>
<br />
</>
)}
Expand Down
7 changes: 6 additions & 1 deletion components/immatriculations/insee.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ const AvisSituationTable: React.FC<{
statutDiffusion={etablissement.statutDiffusion}
since={etablissement.dateFermeture}
/>,
<AvisSituationLink etablissement={etablissement} label="Télécharger" />,
<AvisSituationLink
session={session}
etablissement={etablissement}
label="Télécharger"
/>,
])}
/>
);
Expand Down Expand Up @@ -78,6 +82,7 @@ const AvisSituationSection: React.FC<IProps> = ({ uniteLegale, session }) => (
Si vous avez plusieurs établisements et ne savez pas quel avis de
situation utiliser,{' '}
<AvisSituationLink
session={session}
etablissement={uniteLegale.siege}
label="téléchargez l’avis de situation Sirene du siège social"
/>
Expand Down
11 changes: 10 additions & 1 deletion components/justificatifs/avis-situation-link/index.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
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 { 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 }) =>
}> = ({ etablissement, label, session }) =>
estDiffusible(etablissement) ? (
<a
target="_blank"
Expand All @@ -18,6 +22,11 @@ const AvisSituationLink: React.FC<{
>
{label || 'Avis de situation'}
</a>
) : hasRights(session, EScope.isAgent) ? (
<FAQLink tooltipLabel="Document non disponible">
L’avis de situation INSEE n’est pas disponible pour les entreprises non
diffusibles, y compris les agents publics.
</FAQLink>
) : (
<>{nonDiffusibleDataFormatter('document non-diffusible')}</>
);
Expand Down
1 change: 1 addition & 0 deletions components/unite-legale-section/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ const UniteLegaleSection: React.FC<{
<li>
Avis de situation Insee :{' '}
<AvisSituationLink
session={session}
etablissement={uniteLegale.siege}
label="télécharger"
/>
Expand Down
1 change: 0 additions & 1 deletion cypress/e2e/advanced-research.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down

0 comments on commit 14c2aa8

Please sign in to comment.