fix: Add ability to permanently delete documents in trash (#2192)
* Align false conditions before true * Update documents.delete endpoint for permanent delete * Add permanent delete to events table and integrate with socket.io * Add permanent delete to document menu * Update parentDocumentId of direct child to null * Add translation * Add test for permanent delete * Add space * Update app/scenes/DocumentPermanentDelete.js Co-authored-by: Tom Moor <tom.moor@gmail.com> * Update app/stores/DocumentsStore.js Co-authored-by: Tom Moor <tom.moor@gmail.com> * Update server/commands/documentPermanentDeleter.js Co-authored-by: Tom Moor <tom.moor@gmail.com> * Update app/scenes/DocumentPermanentDelete.js Co-authored-by: Tom Moor <tom.moor@gmail.com> * Change socket room from team to collection * Add translation * Create log func for commands * Move tests from utils to permanentDeleter command * Add additional tests * Set redirect to trash * Return promise from beforeEach * Add undeleted documents validation * Include deleteAt attribute in db query * Update server/commands/documentPermanentDeleter.js Co-authored-by: Tom Moor <tom.moor@gmail.com> * tweak language Co-authored-by: Tom Moor <tom.moor@gmail.com>
This commit is contained in:
@ -2201,6 +2201,26 @@ describe("#documents.delete", () => {
|
||||
expect(body.success).toEqual(true);
|
||||
});
|
||||
|
||||
it("should allow permanently deleting a document", async () => {
|
||||
const user = await buildUser();
|
||||
const document = await buildDocument({
|
||||
userId: user.id,
|
||||
teamId: user.teamId,
|
||||
});
|
||||
|
||||
await server.post("/api/documents.delete", {
|
||||
body: { token: user.getJwtToken(), id: document.id },
|
||||
});
|
||||
|
||||
const res = await server.post("/api/documents.delete", {
|
||||
body: { token: user.getJwtToken(), id: document.id, permanent: true },
|
||||
});
|
||||
const body = await res.json();
|
||||
|
||||
expect(res.status).toEqual(200);
|
||||
expect(body.success).toEqual(true);
|
||||
});
|
||||
|
||||
it("should allow deleting document without collection", async () => {
|
||||
const { user, document, collection } = await seed();
|
||||
|
||||
|
Reference in New Issue
Block a user