- Notifications
You must be signed in to change notification settings - Fork 452
✨ List and restore deleted docs #1450
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| Size Change: +2.26 kB (+0.06%) Total Size: 3.66 MB
|
6155329 to 9bb3f51 Compare 7616ea8 to a9be1c2 Compare 304c07c to 3ec8300 Compare 3256335 to 21e1bf6 Compare | You can test this feature now from https://1450-docs.ppr-docs.beta.numerique.gouv.fr/ ! |
6d6ef73 to 33928f0 Compare | hey @AntoLC This is pretty good I like it ! juste One thing : tabfocu.mp4 |
Ovgodd left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice ! I suggested some little things !
| const parentDoc = parentNode?.data.value as Doc; | ||
| if (!parentDoc) { | ||
| return currentDoc.abilities.move && isDesktop; | ||
| <Overlayer isOverlay={currentDoc.deleted_at != null}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can do this, avoiding the unwanted tabfocus into the greyed subitem,
But react thinks Inert is not valid html ,
So maybe we can add this too :
// global.d.ts declare module 'react' { interface HTMLAttributes<T> { inert?: '' | undefined; } }
| <Overlayer isOverlay={currentDoc.deleted_at != null}> | |
| <section | |
| aria-disabled={!!doc.deleted_at} | |
| {...(doc.deleted_at | |
| ? ({ inert: '' } satisfies React.HTMLAttributes<HTMLElement>) | |
| : {})} | |
| <Overlayer isOverlay={currentDoc.deleted_at != null}> |
WDYT ? it is a proposition but I am not sure of it
Or I can look at the a11y of it after merging the main feature !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done:
docs/src/frontend/apps/impress/src/features/docs/doc-tree/components/DocTree.tsx
Line 292 in cd523ea
| <Overlayer isOverlay={currentDoc.deleted_at != null} inert> |
| let dateToDisplay = relativeDate(doc.updated_at); | ||
| | ||
| if (isInTrashbin && config?.TRASHBIN_CUTOFF_DAYS && doc.deleted_at) { | ||
| const daysLeft = calculateDaysLeft( | ||
| doc.deleted_at, | ||
| config.TRASHBIN_CUTOFF_DAYS, | ||
| ); | ||
| | ||
| dateToDisplay = `${daysLeft} ${t('days', { count: daysLeft })}`; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
little suggestion, something like that for better readability ?
| let dateToDisplay = relativeDate(doc.updated_at); | |
| if (isInTrashbin && config?.TRASHBIN_CUTOFF_DAYS && doc.deleted_at) { | |
| const daysLeft = calculateDaysLeft( | |
| doc.deleted_at, | |
| config.TRASHBIN_CUTOFF_DAYS, | |
| ); | |
| dateToDisplay = `${daysLeft} ${t('days', { count: daysLeft })}`; | |
| } | |
| const shouldShowDaysLeft = isInTrashbin && config?.TRASHBIN_CUTOFF_DAYS && doc.deleted_at | |
| const daysLeft = | |
| shouldShowDaysLeft | |
| ? calculateDaysLeft(doc.deleted_at, config.TRASHBIN_CUTOFF_DAYS) | |
| : null; | |
| const dateToDisplay = | |
| daysLeft !== null | |
| ? `${daysLeft} ${t('days', { count: daysLeft })}` | |
| : relativeDate(doc.updated_at); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By doing shouldShowDaysLeft we get linter warning, the clear "if" condition helps the linter to know that doc.deleted_at is not undefined. I think it's ok, multiple ternaires do not improve a lot the readability.
5af1da5 to f80eb27 Compare To know when a document in the trashbin will be permanently deleted.
The front needs to know when a document has been deleted. We expose the deleted_at property on a document object,
The abilities for a deleted document were too open. We want to restrict them. Only the restore, retrieve and tree is allowed. The tree method will need some modifications to get the right informations.
The tree endpoint will now return a result only for owners. For other users the endpoint still returns a 403. Also, the endpoint does look for ancestors anymore, it only stay on the current document.
f80eb27 to 11d8000 Compare | The changes from the design reviews has been made as well. |
b10420f to 0f826ed Compare 5c146af to bd78617 Compare
Ovgodd left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice work ! 💯
The design uses Material Symbols for icons. This commit adds the font to the project and updates the Icon component to be able to use it.
List the docs deleted in the trashbin list, it is displayed in the docs grid.
We can now restore a doc from the trashbin list actions.
Whe the doc is deleted, the doc page is a bit different, we have to adapt the doc header to add some information and actions that are relevant for a deleted doc.
We want to improve the accessibility of our BoxButton component by adding a theme focus visible style. This will help users who navigate using the keyboard to easily identify which button is currently focused. To do so we have to move some theme styles to the Box component to be able to use them in BoxButton.
A circular dependency was introduced in the previous commit. This commit resolves the circular dependency by refactoring the code to remove the circular reference.
bd78617 to 127c90c Compare 
Purpose
We want to be able to see the deleted documents, and to restore them if needed.
Proposal
Demo
🚨 Take care
After
TRASHBIN_CUTOFF_DAYSdays, the doc will be definitively deleted, 30 by default.docs/src/backend/impress/settings.py
Lines 430 to 432 in 9bb3f51