Transfer changes from enterprise codebase
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import invariant from "invariant";
|
||||
import { concat, find, last } from "lodash";
|
||||
import { concat, find, last, sortBy } from "lodash";
|
||||
import { computed, action } from "mobx";
|
||||
import {
|
||||
CollectionPermission,
|
||||
@@ -50,9 +50,12 @@ export default class CollectionsStore extends BaseStore<Collection> {
|
||||
@computed
|
||||
get orderedData(): Collection[] {
|
||||
let collections = Array.from(this.data.values());
|
||||
collections = collections.filter((collection) =>
|
||||
collection.deletedAt ? false : true
|
||||
);
|
||||
collections = collections
|
||||
.filter((collection) => !collection.deletedAt)
|
||||
.filter(
|
||||
(collection) =>
|
||||
this.rootStore.policies.abilities(collection.id).readDocument
|
||||
);
|
||||
return collections.sort((a, b) => {
|
||||
if (a.index === b.index) {
|
||||
return a.updatedAt > b.updatedAt ? -1 : 1;
|
||||
@@ -62,6 +65,14 @@ export default class CollectionsStore extends BaseStore<Collection> {
|
||||
});
|
||||
}
|
||||
|
||||
@computed
|
||||
get all(): Collection[] {
|
||||
return sortBy(
|
||||
Array.from(this.data.values()),
|
||||
(collection) => collection.name
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* List of paths to each of the documents, where paths are composed of id and title/name pairs
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user