note content refactoring, WIP

This commit is contained in:
zadam
2019-02-06 21:29:23 +01:00
parent 8884177d9f
commit c487a95bc7
17 changed files with 158 additions and 123 deletions

View File

@@ -48,14 +48,16 @@ async function updateEntity(sync, entity, sourceId) {
}
}
function deserializeNoteContentBuffer(note) {
if (note.content !== null && (note.type === 'file' || note.type === 'image')) {
note.content = Buffer.from(note.content, 'base64');
async function deserializeNoteContentBuffer(note) {
const noteContent = await note.getNoteContent();
if (noteContent.content !== null && (note.type === 'file' || note.type === 'image')) {
noteContent.content = Buffer.from(noteContent.content, 'base64');
}
}
async function updateNote(entity, sourceId) {
deserializeNoteContentBuffer(entity);
await deserializeNoteContentBuffer(entity);
const origNote = await sql.getRow("SELECT * FROM notes WHERE noteId = ?", [entity.noteId]);