fix incorrect switch between protected/unprotected states causing content not being encrypted, fixes #510

This commit is contained in:
zadam 2019-05-04 14:46:17 +02:00
parent 7ce98b0b28
commit a9762c5139
2 changed files with 6 additions and 1 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "trilium",
"version": "0.31.3",
"version": "0.31.4",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -186,8 +186,13 @@ async function protectNoteRecursively(note, protect) {
async function protectNote(note, protect) {
if (protect !== note.isProtected) {
const content = await note.getContent();
note.isProtected = protect;
// this will force de/encryption
await note.setContent(content);
await note.save();
}