distinction when user asks for action (encryption -> modal) and system asks for password (viewing - non-modal)

This commit is contained in:
azivner 2017-09-05 23:51:50 -04:00
parent a024978d7b
commit d41c9349b8

View File

@ -156,13 +156,16 @@ function setNoteBackgroundIfEncrypted(note) {
let globalEncryptionCallback = null; let globalEncryptionCallback = null;
function handleEncryption(requireEncryption, callback) { function handleEncryption(requireEncryption, modal, callback) {
if (requireEncryption && globalEncryptionKey === null) { if (requireEncryption && globalEncryptionKey === null) {
globalEncryptionCallback = callback; globalEncryptionCallback = callback;
$("#noteDetailWrapper").hide(); if (!modal) {
$("#noteDetailWrapper").hide();
}
$("#encryptionPasswordDialog").dialog({ $("#encryptionPasswordDialog").dialog({
modal: false, modal: modal,
width: 400 width: 400
}); });
} }
@ -183,7 +186,7 @@ function loadNote(noteId) {
$("#noteTitle").focus().select(); $("#noteTitle").focus().select();
} }
handleEncryption(note.detail.encryption > 0, () => { handleEncryption(note.detail.encryption > 0, false, () => {
$("#noteDetailWrapper").show(); $("#noteDetailWrapper").show();
try { try {
$("#encryptionPasswordDialog").dialog('close'); $("#encryptionPasswordDialog").dialog('close');
@ -331,7 +334,7 @@ function encryptNote(note) {
} }
function encryptNoteAndSendToServer() { function encryptNoteAndSendToServer() {
handleEncryption(true, () => { handleEncryption(true, true, () => {
const note = globalNote; const note = globalNote;
updateNoteFromInputs(note); updateNoteFromInputs(note);
@ -347,7 +350,7 @@ function encryptNoteAndSendToServer() {
} }
function decryptNoteAndSendToServer() { function decryptNoteAndSendToServer() {
handleEncryption(true, () => { handleEncryption(true, true, () => {
const note = globalNote; const note = globalNote;
updateNoteFromInputs(note); updateNoteFromInputs(note);