Draft Documents (#518)
* Mostly there * Fix up specs * Working scope, updated tests * Don't record view on draft * PR feedback * Highlight drafts nav item * Bugaboos * Styling * Refactoring, gradually addressing Jori feedback * Show collection in drafts list Flow fixes * Ensure menu actions are hidden when draft
This commit is contained in:
@@ -71,10 +71,18 @@ class DocumentsStore extends BaseStore {
|
||||
}
|
||||
|
||||
@computed
|
||||
get starred(): Array<Document> {
|
||||
get starred(): Document[] {
|
||||
return _.filter(this.data.values(), 'starred');
|
||||
}
|
||||
|
||||
@computed
|
||||
get drafts(): Document[] {
|
||||
return _.filter(
|
||||
_.orderBy(this.data.values(), 'updatedAt', 'desc'),
|
||||
doc => !doc.publishedAt
|
||||
);
|
||||
}
|
||||
|
||||
@computed
|
||||
get active(): ?Document {
|
||||
return this.ui.activeDocumentId
|
||||
@@ -130,14 +138,19 @@ class DocumentsStore extends BaseStore {
|
||||
};
|
||||
|
||||
@action
|
||||
fetchStarred = async (): Promise<*> => {
|
||||
await this.fetchPage('starred');
|
||||
fetchStarred = async (options: ?PaginationParams): Promise<*> => {
|
||||
await this.fetchPage('starred', options);
|
||||
};
|
||||
|
||||
@action
|
||||
fetchDrafts = async (options: ?PaginationParams): Promise<*> => {
|
||||
await this.fetchPage('drafts', options);
|
||||
};
|
||||
|
||||
@action
|
||||
search = async (
|
||||
query: string,
|
||||
options?: PaginationParams
|
||||
options: ?PaginationParams
|
||||
): Promise<string[]> => {
|
||||
const res = await client.get('/documents.search', {
|
||||
...options,
|
||||
|
||||
Reference in New Issue
Block a user