unprotecting note outside of protected session is not forbidden because it could overwrite previous note

This commit is contained in:
azivner
2018-08-17 15:21:59 +02:00
parent 145efe67c3
commit a42bbba0e5
3 changed files with 14 additions and 6 deletions

View File

@@ -119,11 +119,12 @@ async function saveNoteIfChanged() {
}
function setNoteBackgroundIfProtected(note) {
const isProtected = !!note.isProtected;
const isProtected = note.isProtected;
$noteDetailWrapper.toggleClass("protected", isProtected);
$protectButton.toggleClass("active", isProtected);
$unprotectButton.toggleClass("active", !isProtected);
$unprotectButton.prop("disabled", !protectedSessionHolder.isProtectedSessionAvailable());
}
let isNewNoteCreated = false;
@@ -157,8 +158,6 @@ async function loadNoteDetail(noteId) {
setNoteBackgroundIfProtected(currentNote);
await handleProtectedSession();
$noteDetailWrapper.show();
noteChangeDisabled = true;
@@ -171,6 +170,8 @@ async function loadNoteDetail(noteId) {
$noteDetailComponents.hide();
await handleProtectedSession();
await getComponent(currentNote.type).show();
}
finally {