Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

fix: ask for password before deleting locked note

thecodrr0c8f3006389b
diff --git a/apps/web/src/components/note/index.js b/apps/web/src/components/note/index.js
index 1087b4bd6..032abf9fb 100644
--- a/apps/web/src/components/note/index.js
+++ b/apps/web/src/components/note/index.js
@@ -8,6 +8,8 @@ import { confirm } from "../dialogs/confirm";
import { showMoveNoteDialog } from "../dialogs/movenotedialog";
import { store, useStore } from "../../stores/note-store";
import { store as editorStore } from "../../stores/editor-store";
+import { showPasswordDialog } from "../dialogs/passworddialog";
+import { db } from "../../common";
const dropdownRefs = [];
const menuItems = (note, index) => [
@@ -42,7 +44,16 @@ const menuItems = (note, index) => [
{
title: "Move to Trash",
color: "red",
- onClick: () => {
+ onClick: async () => {
+ if (note.locked) {
+ const res = await showPasswordDialog("unlock_note", password => {
+ return db.vault
+ .unlock(password)
+ .then(() => true)
+ .catch(() => false);
+ });
+ if (!res) return;
+ }
confirm(
Icon.Trash2,
"Delete",