1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-26 22:41:17 +02:00

All: Better handling of encrypted data on UI side and prevent modification of encrypted notes

This commit is contained in:
Laurent Cozic
2017-12-14 20:21:36 +00:00
parent 2c608bca3c
commit e9bb5bee9d
9 changed files with 108 additions and 40 deletions

View File

@@ -37,16 +37,23 @@ shared.saveNoteButton_press = async function(comp) {
}
// Save only the properties that have changed
let diff = null;
// let diff = null;
// if (!isNew) {
// diff = BaseModel.diffObjects(comp.state.lastSavedNote, note);
// diff.type_ = note.type_;
// diff.id = note.id;
// } else {
// diff = Object.assign({}, note);
// }
// const savedNote = await Note.save(diff);
let options = {};
if (!isNew) {
diff = BaseModel.diffObjects(comp.state.lastSavedNote, note);
diff.type_ = note.type_;
diff.id = note.id;
} else {
diff = Object.assign({}, note);
options.fields = BaseModel.diffObjectsFields(comp.state.lastSavedNote, note);
}
const savedNote = await Note.save(diff);
const savedNote = ('fields' in options) && !options.fields.length ? Object.assign({}, note) : await Note.save(note, { userSideValidation: true });
const stateNote = comp.state.note;
// Re-assign any property that might have changed during saving (updated_time, etc.)