Pinned documents (#608)
* Migrations and API for pinned documents * Documentation * Add pin icon * Fin. * v0.2.0 * Remove pin from DocumentPreview, add general menu Add Pinned documents header * Tidy * Fixed: Drafts appearing on collection home
This commit is contained in:
@@ -60,10 +60,19 @@ class DocumentsStore extends BaseStore {
|
||||
return docs;
|
||||
}
|
||||
|
||||
recentlyEditedIn(documentIds: string[]): Document[] {
|
||||
pinnedInCollection(collectionId: string): Document[] {
|
||||
return _.filter(
|
||||
this.recentlyEditedInCollection(collectionId),
|
||||
document => document.pinned
|
||||
);
|
||||
}
|
||||
|
||||
recentlyEditedInCollection(collectionId: string): Document[] {
|
||||
return _.orderBy(
|
||||
_.filter(this.data.values(), document =>
|
||||
documentIds.includes(document.id)
|
||||
_.filter(
|
||||
this.data.values(),
|
||||
document =>
|
||||
document.collectionId === collectionId && !!document.publishedAt
|
||||
),
|
||||
'updatedAt',
|
||||
'desc'
|
||||
@@ -147,6 +156,11 @@ class DocumentsStore extends BaseStore {
|
||||
await this.fetchPage('drafts', options);
|
||||
};
|
||||
|
||||
@action
|
||||
fetchPinned = async (options: ?PaginationParams): Promise<*> => {
|
||||
await this.fetchPage('pinned', options);
|
||||
};
|
||||
|
||||
@action
|
||||
search = async (
|
||||
query: string,
|
||||
|
||||
Reference in New Issue
Block a user