Document Archive (#921)

* WIP: Archive

* WIP

* Finishing up archive endpoints

* WIP

* Update docs

* Flow

* Stash

* Add toast message confirmations

* Redirect handling, fixed publishhing info for archived docs

* Redirect to collection instead of home, remove unused pub info

* Account for deleted parent

* Trash -> Archive
Allow reading of archived docs

* Dont overload deletedAt

* Fixes

* 💚

* ParentDocumentId wipe for unarchived sub docs

* Fix: CMD+S exits editing
Fix: Duplicate user name on published but unedited docs

* Improve jank on paginated lists

* Prevent editing when archived

* 💚
Separate lint / flow steps
This commit is contained in:
Tom Moor
2019-04-06 16:20:27 -07:00
committed by GitHub
parent 76957865bb
commit 642c11ff7d
39 changed files with 811 additions and 311 deletions

View File

@@ -36,6 +36,8 @@ export default class Document extends BaseModel {
emoji: string;
parentDocument: ?string;
publishedAt: ?string;
archivedAt: string;
deletedAt: ?string;
url: string;
urlId: string;
shareUrl: ?string;
@@ -78,6 +80,16 @@ export default class Document extends BaseModel {
return [];
}
@computed
get isArchived(): boolean {
return !!this.archivedAt;
}
@computed
get isDeleted(): boolean {
return !!this.deletedAt;
}
@computed
get isDraft(): boolean {
return !this.publishedAt;
@@ -115,7 +127,11 @@ export default class Document extends BaseModel {
this.updateTitle();
};
restore = (revision: Revision) => {
archive = () => {
return this.store.archive(this);
};
restore = (revision: ?Revision) => {
return this.store.restore(this, revision);
};