diff --git a/src/frontend/apps/impress/src/features/docs/doc-collaboration/hook/usePublicKeyRegistry.tsx b/src/frontend/apps/impress/src/features/docs/doc-collaboration/hook/usePublicKeyRegistry.tsx index 53355143..31f262d6 100644 --- a/src/frontend/apps/impress/src/features/docs/doc-collaboration/hook/usePublicKeyRegistry.tsx +++ b/src/frontend/apps/impress/src/features/docs/doc-collaboration/hook/usePublicKeyRegistry.tsx @@ -22,6 +22,7 @@ export interface PublicKeyMismatch { */ export function usePublicKeyRegistry( accessesPublicKeysPerUser: Record | undefined, + currentUserId?: string, ) { const [mismatches, setMismatches] = useState([]); const [loading, setLoading] = useState(true); @@ -43,6 +44,13 @@ export function usePublicKeyRegistry( for (const [userId, currentKey] of Object.entries( accessesPublicKeysPerUser!, )) { + // Skip the current user — they know about their own key changes + if (currentUserId && userId === currentUserId) { + // Still store the key so it stays up to date locally + await db.put(STORE_KNOWN_PUBLIC_KEYS, currentKey, `user:${userId}`); + continue; + } + const knownKey: string | undefined = await db.get( STORE_KNOWN_PUBLIC_KEYS, `user:${userId}`, @@ -74,7 +82,7 @@ export function usePublicKeyRegistry( return () => { cancelled = true; }; - }, [accessesPublicKeysPerUser]); + }, [accessesPublicKeysPerUser, currentUserId]); const acceptNewKey = useCallback( async (userId: string) => { diff --git a/src/frontend/apps/impress/src/features/docs/doc-header/components/BoutonShare.tsx b/src/frontend/apps/impress/src/features/docs/doc-header/components/BoutonShare.tsx index 61c4d03c..dd9e4dd8 100644 --- a/src/frontend/apps/impress/src/features/docs/doc-header/components/BoutonShare.tsx +++ b/src/frontend/apps/impress/src/features/docs/doc-header/components/BoutonShare.tsx @@ -43,15 +43,6 @@ export const BoutonShare = ({ return null; } - const warningIcon = hasKeyWarning ? ( - - ) : null; - if (hasAccesses) { return ( - {warningIcon} - + ); }; diff --git a/src/frontend/apps/impress/src/features/docs/doc-header/components/DocToolBox.tsx b/src/frontend/apps/impress/src/features/docs/doc-header/components/DocToolBox.tsx index 519fd382..4df2590e 100644 --- a/src/frontend/apps/impress/src/features/docs/doc-header/components/DocToolBox.tsx +++ b/src/frontend/apps/impress/src/features/docs/doc-header/components/DocToolBox.tsx @@ -80,6 +80,7 @@ export const DocToolBox = ({ const { hasMismatches: hasKeyWarnings } = usePublicKeyRegistry( doc.accesses_public_keys_per_user, + encryptionSettings?.userId, ); const { isSmallMobile, isMobile } = useResponsiveStore(); @@ -239,10 +240,25 @@ export const DocToolBox = ({ $gap={spacingsTokens['2xs']} > {doc.is_encrypted && ( - <> - [chiffrement activé] - {/* TODO */} - + + + + {t('Encrypted')} + + )} setIsModalRemoveEncryptionOpen(false)} - onSuccess={() => { - // - // TODO: probably it should make an hard refresh to get the setup - // but it should before register content in database with clean accesses, and broadcast the information through websocket - // - }} - /> - )} + setIsModalRemoveEncryptionOpen(false)} + onSuccess={() => { + // + // TODO: probably it should make an hard refresh to get the setup + // but it should before register content in database with clean accesses, and broadcast the information through websocket + // + }} + /> + )} {selectHistoryModal.isOpen && ( selectHistoryModal.close()} diff --git a/src/frontend/apps/impress/src/features/docs/doc-management/assets/encrypted-document.svg b/src/frontend/apps/impress/src/features/docs/doc-management/assets/encrypted-document.svg index 027fb33b..69f184a8 100644 --- a/src/frontend/apps/impress/src/features/docs/doc-management/assets/encrypted-document.svg +++ b/src/frontend/apps/impress/src/features/docs/doc-management/assets/encrypted-document.svg @@ -95,10 +95,9 @@ stroke="white" stroke-width="1.21628" /> - + + +