From 02a42661b02a8bfe888479302ef11ff22b7bbc2e Mon Sep 17 00:00:00 2001 From: thecodrr Date: Wed, 23 Mar 2022 15:37:14 +0500 Subject: [PATCH] fix: don't show confirm dialog if delete note count is 1 --- apps/web/src/common/multi-select.ts | 4 ++-- apps/web/src/components/note/index.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/web/src/common/multi-select.ts b/apps/web/src/common/multi-select.ts index a364f768a..e737064d5 100644 --- a/apps/web/src/common/multi-select.ts +++ b/apps/web/src/common/multi-select.ts @@ -8,9 +8,9 @@ import Vault from "./vault"; import { showItemDeletedToast } from "./toasts"; import { TaskManager } from "./task-manager"; -async function moveNotesToTrash(notes: any[]) { +async function moveNotesToTrash(notes: any[], confirm = true) { const item = notes[0]; - if (!(await showMultiDeleteConfirmation(notes.length))) return; + if (confirm && !(await showMultiDeleteConfirmation(notes.length))) return; if (notes.length === 1) { if ( diff --git a/apps/web/src/components/note/index.js b/apps/web/src/components/note/index.js index b1c96aecf..3ab58d6a6 100644 --- a/apps/web/src/components/note/index.js +++ b/apps/web/src/components/note/index.js @@ -377,7 +377,7 @@ const menuItems = [ items.length === 1 && db.monographs.isPublished(items[0].id), disableReason: "Please unpublish this note to move it to trash", onClick: async ({ items }) => { - await Multiselect.moveNotesToTrash(items); + await Multiselect.moveNotesToTrash(items, items.length > 1); }, multiSelect: true, },