fix isProtected consistency for images and files + related consistency check

This commit is contained in:
zadam
2019-03-08 22:25:12 +01:00
parent ae17e4dc60
commit a432ad7483
4 changed files with 20 additions and 8 deletions

View File

@@ -332,19 +332,21 @@ async function updateNote(noteId, noteUpdates) {
const noteTitleChanged = note.title !== noteUpdates.title;
noteUpdates.noteContent.content = await saveLinks(note, noteUpdates.noteContent.content);
note.title = noteUpdates.title;
note.isProtected = noteUpdates.isProtected;
await note.save();
if (note.type !== 'file' && note.type !== 'image') {
const noteContent = await note.getNoteContent();
const noteContent = await note.getNoteContent();
if (!['file', 'image'].includes(note.type)) {
noteUpdates.noteContent.content = await saveLinks(note, noteUpdates.noteContent.content);
noteContent.content = noteUpdates.noteContent.content;
noteContent.isProtected = noteUpdates.isProtected;
await noteContent.save();
}
noteContent.isProtected = noteUpdates.isProtected;
await noteContent.save();
if (noteTitleChanged) {
await triggerNoteTitleChanged(note);
}