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:
@@ -1,5 +1,6 @@
|
||||
// @flow
|
||||
import { action, set, computed } from 'mobx';
|
||||
import addDays from 'date-fns/add_days';
|
||||
import invariant from 'invariant';
|
||||
import { client } from 'utils/ApiClient';
|
||||
import parseTitle from 'shared/utils/parseTitle';
|
||||
@@ -76,6 +77,15 @@ export default class Document extends BaseModel {
|
||||
return !this.publishedAt;
|
||||
}
|
||||
|
||||
@computed
|
||||
get permanentlyDeletedAt(): ?string {
|
||||
if (!this.deletedAt) {
|
||||
return;
|
||||
}
|
||||
|
||||
return addDays(new Date(this.deletedAt), 30).toString();
|
||||
}
|
||||
|
||||
@action
|
||||
share = async () => {
|
||||
const res = await client.post('/shares.create', { documentId: this.id });
|
||||
|
||||
Reference in New Issue
Block a user