Skip to content

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

web: fix locked note status not updating in list

Abdullah Attadee1cf4b5af7
diff --git a/apps/web/src/common/vault.js b/apps/web/src/common/vault.js
index 413b8918f..38235da40 100644
--- a/apps/web/src/common/vault.js
+++ b/apps/web/src/common/vault.js
@@ -94,24 +94,21 @@ class Vault {
}
static lockNote(id) {
- return new Promise(function lock(resolve) {
- db.vault
- .add(id)
- .then(resolve)
- .catch(({ message }) => {
- switch (message) {
- case db.vault.ERRORS.noVault:
- return Vault.createVault();
- case db.vault.ERRORS.vaultLocked:
- return Vault.unlockVault();
- default:
- showToast("error", message);
- console.error(message);
- return false;
- }
- })
- .then((result) => result && lock(resolve));
- });
+ return db.vault
+ .add(id)
+ .then(() => true)
+ .catch(({ message }) => {
+ switch (message) {
+ case db.vault.ERRORS.noVault:
+ return Vault.createVault().then(() => Vault.lockNote(id));
+ case db.vault.ERRORS.vaultLocked:
+ return Vault.unlockVault().then(() => Vault.lockNote(id));
+ default:
+ showToast("error", message);
+ console.error(message);
+ return false;
+ }
+ });
}
static askPassword(action) {