web: do not show success prompt on unlock cancel

This commit is contained in:
Abdullah Atta
2024-01-29 15:36:01 +05:00
parent 35929026a4
commit 807bd683b7
2 changed files with 5 additions and 5 deletions

View File

@@ -369,10 +369,9 @@ const menuItems: (note: any, items?: any[]) => MenuItem[] = (
onClick: async () => {
const { unlock, lock } = store.get();
if (!note.locked) {
await lock(note.id);
showToast("success", "Note locked successfully!");
} else {
await unlock(note.id);
if (await lock(note.id))
showToast("success", "Note locked successfully!");
} else if (await unlock(note.id)) {
showToast("success", "Note unlocked successfully!");
}
},

View File

@@ -123,10 +123,11 @@ class NoteStore extends BaseStore {
};
lock = async (id) => {
await Vault.lockNote(id);
if (!(await Vault.lockNote(id))) return false;
this.refreshItem(id);
if (editorStore.get().session.id === id)
await editorStore.openSession(id, true);
return true;
};
readonly = async (id) => {