syncification

This commit is contained in:
zadam
2020-06-20 12:31:38 +02:00
parent 30062d687f
commit 88348c560c
97 changed files with 1673 additions and 1700 deletions

View File

@@ -6,17 +6,17 @@ const dateUtils = require('../services/date_utils');
/**
* @param {Note} note
*/
async function protectNoteRevisions(note) {
for (const revision of await note.getRevisions()) {
function protectNoteRevisions(note) {
for (const revision of note.getRevisions()) {
if (note.isProtected !== revision.isProtected) {
const content = await revision.getContent();
const content = revision.getContent();
revision.isProtected = note.isProtected;
// this will force de/encryption
await revision.setContent(content);
revision.setContent(content);
await revision.save();
revision.save();
}
}
}
@@ -25,12 +25,12 @@ async function protectNoteRevisions(note) {
* @param {Note} note
* @return {NoteRevision}
*/
async function createNoteRevision(note) {
if (await note.hasLabel("disableVersioning")) {
function createNoteRevision(note) {
if (note.hasLabel("disableVersioning")) {
return;
}
const noteRevision = await new NoteRevision({
const noteRevision = new NoteRevision({
noteId: note.noteId,
// title and text should be decrypted now
title: note.title,
@@ -45,7 +45,7 @@ async function createNoteRevision(note) {
dateCreated: dateUtils.localNowDateTime()
}).save();
await noteRevision.setContent(await note.getContent());
noteRevision.setContent(note.getContent());
return noteRevision;
}
@@ -53,4 +53,4 @@ async function createNoteRevision(note) {
module.exports = {
protectNoteRevisions,
createNoteRevision
};
};