From deaecda5027a44cc0018b9824b1b41b60ac19df1 Mon Sep 17 00:00:00 2001 From: thecodrr Date: Tue, 21 Apr 2020 13:03:25 +0500 Subject: [PATCH] feat: impl permanent delete in multi select trash --- apps/web/src/common/selectionoptions.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/apps/web/src/common/selectionoptions.js b/apps/web/src/common/selectionoptions.js index 5be8f7a96..2e2a1c656 100644 --- a/apps/web/src/common/selectionoptions.js +++ b/apps/web/src/common/selectionoptions.js @@ -31,6 +31,7 @@ const DeleteOption = createOption("deleteOption", Icon.Trash, async function ( ) return; const item = state.selectedItems[0]; + var isAnyNoteOpened = false; const items = state.selectedItems.map((item) => { if (item.id === editorStore.get().session.id) isAnyNoteOpened = true; @@ -38,6 +39,13 @@ const DeleteOption = createOption("deleteOption", Icon.Trash, async function ( return item.id; }); + if (item.dateDeleted) { + // we are in trash + await db.trash.delete(...items); + trashStore.refresh(); + return; + } + if (isAnyNoteOpened) { editorStore.newSession(); }