fix: Documents in deleted collection should appear in trash (#1362)
* fix: Documents from deleted collection should show in trash * improve messaging * test: Add documents.move tests feat: Add ability to restore trashed documents from deleted collection * update store * fix * ui * lint * fix: Improve breadcrumb
This commit is contained in:
@@ -12,11 +12,9 @@ import {
|
||||
} from "lodash";
|
||||
import { observable, action, computed, runInAction } from "mobx";
|
||||
import naturalSort from "shared/utils/naturalSort";
|
||||
|
||||
import BaseStore from "stores/BaseStore";
|
||||
import RootStore from "stores/RootStore";
|
||||
import Document from "models/Document";
|
||||
import Revision from "models/Revision";
|
||||
import type { FetchOptions, PaginationParams, SearchResult } from "types";
|
||||
import { client } from "utils/ApiClient";
|
||||
|
||||
@@ -435,6 +433,7 @@ export default class DocumentsStore extends BaseStore<Document> {
|
||||
|
||||
res.data.documents.forEach(this.add);
|
||||
res.data.collections.forEach(this.rootStore.collections.add);
|
||||
this.addPolicies(res.policies);
|
||||
};
|
||||
|
||||
@action
|
||||
@@ -527,10 +526,10 @@ export default class DocumentsStore extends BaseStore<Document> {
|
||||
};
|
||||
|
||||
@action
|
||||
restore = async (document: Document, revision?: Revision) => {
|
||||
restore = async (document: Document, options = {}) => {
|
||||
const res = await client.post("/documents.restore", {
|
||||
id: document.id,
|
||||
revisionId: revision ? revision.id : undefined,
|
||||
...options,
|
||||
});
|
||||
runInAction("Document#restore", () => {
|
||||
invariant(res && res.data, "Data should be available");
|
||||
|
||||
Reference in New Issue
Block a user