feat: Trash (#1082)

* wip: trash

* Enable restoration of deleted documents

* update Trash icon

* Add endpoint to trigger garbage collection

* fix: account for drafts

* fix: Archived documents should be deletable

* fix: Missing delete cascade

* bump: upgrade rich-markdown-editor
This commit is contained in:
Tom Moor
2019-11-18 18:51:32 -08:00
committed by GitHub
parent 14f6e6abad
commit e404955394
20 changed files with 346 additions and 30 deletions

View File

@@ -132,6 +132,7 @@ class DocumentMenu extends React.Component<Props> {
const can = policies.abilities(document.id);
const canShareDocuments = can.share && auth.team && auth.team.sharing;
const canViewHistory = can.read && !can.restore;
return (
<DropdownMenu
@@ -140,7 +141,7 @@ class DocumentMenu extends React.Component<Props> {
onOpen={onOpen}
onClose={onClose}
>
{can.unarchive && (
{(can.unarchive || can.restore) && (
<DropdownMenuItem onClick={this.handleRestore}>
Restore
</DropdownMenuItem>
@@ -176,11 +177,13 @@ class DocumentMenu extends React.Component<Props> {
Share link
</DropdownMenuItem>
)}
<hr />
{can.read && (
<DropdownMenuItem onClick={this.handleDocumentHistory}>
Document history
</DropdownMenuItem>
{canViewHistory && (
<React.Fragment>
<hr />
<DropdownMenuItem onClick={this.handleDocumentHistory}>
Document history
</DropdownMenuItem>
</React.Fragment>
)}
{can.update && (
<DropdownMenuItem