From d41c9349b89e1519b1c2ba8a86cb5c32c1a27cc5 Mon Sep 17 00:00:00 2001 From: azivner Date: Tue, 5 Sep 2017 23:51:50 -0400 Subject: [PATCH] distinction when user asks for action (encryption -> modal) and system asks for password (viewing - non-modal) --- static/js/note.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/static/js/note.js b/static/js/note.js index 5a18ec281..352025422 100644 --- a/static/js/note.js +++ b/static/js/note.js @@ -156,13 +156,16 @@ function setNoteBackgroundIfEncrypted(note) { let globalEncryptionCallback = null; -function handleEncryption(requireEncryption, callback) { +function handleEncryption(requireEncryption, modal, callback) { if (requireEncryption && globalEncryptionKey === null) { globalEncryptionCallback = callback; - $("#noteDetailWrapper").hide(); + if (!modal) { + $("#noteDetailWrapper").hide(); + } + $("#encryptionPasswordDialog").dialog({ - modal: false, + modal: modal, width: 400 }); } @@ -183,7 +186,7 @@ function loadNote(noteId) { $("#noteTitle").focus().select(); } - handleEncryption(note.detail.encryption > 0, () => { + handleEncryption(note.detail.encryption > 0, false, () => { $("#noteDetailWrapper").show(); try { $("#encryptionPasswordDialog").dialog('close'); @@ -331,7 +334,7 @@ function encryptNote(note) { } function encryptNoteAndSendToServer() { - handleEncryption(true, () => { + handleEncryption(true, true, () => { const note = globalNote; updateNoteFromInputs(note); @@ -347,7 +350,7 @@ function encryptNoteAndSendToServer() { } function decryptNoteAndSendToServer() { - handleEncryption(true, () => { + handleEncryption(true, true, () => { const note = globalNote; updateNoteFromInputs(note);