Skip to content

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

fix: clarify what's happening when deleting a locked note

thecodrr8c7434fc4141
diff --git a/apps/web/src/common/dialogcontroller.js b/apps/web/src/common/dialogcontroller.js
index 143c716eb..eaeefc149 100644
--- a/apps/web/src/common/dialogcontroller.js
+++ b/apps/web/src/common/dialogcontroller.js
@@ -339,6 +339,12 @@ function getDialogData(type) {
subtitle: "Your note will be unencrypted and removed from the vault.",
positiveButtonText: "Unlock note",
};
+ case "unlock_and_delete_note":
+ return {
+ title: "Delete note",
+ subtitle: "Please unlock this note to move it to trash.",
+ positiveButtonText: "Unlock & delete",
+ };
case "change_password":
return {
title: "Change vault password",
diff --git a/apps/web/src/common/multi-select.ts b/apps/web/src/common/multi-select.ts
index 0c54994b0..ad5841f2b 100644
--- a/apps/web/src/common/multi-select.ts
+++ b/apps/web/src/common/multi-select.ts
@@ -15,7 +15,11 @@ async function moveNotesToTrash(notes: any[]) {
if (isMultiselect) {
if (!(await showMultiDeleteConfirmation(notes.length))) return;
} else {
- if (item.locked && !(await Vault.unlockNote(item.id))) return;
+ if (
+ item.locked &&
+ !(await Vault.unlockNote(item.id, "unlock_and_delete_note"))
+ )
+ return;
}
const items = notes.map((item) => {
diff --git a/apps/web/src/common/vault.js b/apps/web/src/common/vault.js
index 01e8c996b..7d97578d7 100644
--- a/apps/web/src/common/vault.js
+++ b/apps/web/src/common/vault.js
@@ -56,9 +56,9 @@ class Vault {
);
}
- static unlockNote(id) {
+ static unlockNote(id, type = "unlock_note") {
return new Promise((resolve) => {
- return showPasswordDialog("unlock_note", ({ password }) => {
+ return showPasswordDialog(type, ({ password }) => {
return db.vault
.remove(id, password)
.then(() => true)