added "update pojo" stage in entity saving to avoid encrypting data on protected note directly on the entity

This commit is contained in:
azivner
2018-11-30 10:20:03 +01:00
parent e37dd69827
commit ee1e4fc710
4 changed files with 27 additions and 10 deletions

View File

@@ -606,10 +606,6 @@ class Note extends Entity {
// we do this here because encryption needs the note ID for the IV
this.generateIdIfNecessary();
if (this.isProtected) {
protectedSessionService.encryptNote(this);
}
if (!this.isDeleted) {
this.isDeleted = false;
}
@@ -624,6 +620,17 @@ class Note extends Entity {
this.dateModified = dateUtils.nowDate();
}
}
// cannot be static!
updatePojo(pojo) {
if (pojo.isProtected) {
protectedSessionService.encryptNote(pojo);
}
delete pojo.jsonContent;
delete pojo.isContentAvailable;
delete pojo.__attributeCache;
}
}
module.exports = Note;