fix error when saving unprotected notes

This commit is contained in:
azivner 2017-11-17 18:56:52 -05:00
parent a6bf04f8d4
commit c4a9aaa52d
3 changed files with 12 additions and 3 deletions

View File

@ -1 +1 @@
module.exports = { build_date:"2017-11-16T19:29:52-05:00", build_revision: "c371ffb5974d8dccaec76c78dfa91dd54fcc624e" }; module.exports = { build_date:"2017-11-17T00:09:29-05:00", build_revision: "a6bf04f8d4dc92445e6b4decd7dbbaa2f3e3ebaa" };

View File

@ -166,7 +166,7 @@ async function updateNote(noteId, newNote, ctx) {
await sync_table.addNoteHistorySync(newNoteHistoryId); await sync_table.addNoteHistorySync(newNoteHistoryId);
} }
await protectNoteHistory(noteId, ctx.getDataKey(), newNote.detail.is_protected); await protectNoteHistory(noteId, ctx.getDataKeyOrNull(), newNote.detail.is_protected);
await addNoteAudits(origNoteDetail, newNote.detail, ctx.browserId); await addNoteAudits(origNoteDetail, newNote.detail, ctx.browserId);

View File

@ -17,9 +17,18 @@ module.exports = function(req) {
return protected_session.getDataKey(req); return protected_session.getDataKey(req);
} }
function getDataKeyOrNull() {
if (!isProtectedSessionAvailable()) {
return null;
}
return protected_session.getDataKey(req);
}
return { return {
browserId, browserId,
isProtectedSessionAvailable, isProtectedSessionAvailable,
getDataKey getDataKey,
getDataKeyOrNull
}; };
}; };