mirror of
https://github.com/zadam/trilium.git
synced 2025-11-13 00:35:50 +01:00
simplified updating note content
This commit is contained in:
@@ -21,7 +21,7 @@ function updateFile(req) {
|
||||
return [404, `Note ${noteId} doesn't exist.`];
|
||||
}
|
||||
|
||||
noteRevisionService.createNoteRevision(note);
|
||||
note.saveNoteRevision();
|
||||
|
||||
note.mime = file.mimetype.toLowerCase();
|
||||
note.save();
|
||||
@@ -30,8 +30,6 @@ function updateFile(req) {
|
||||
|
||||
note.setLabel('originalFileName', file.originalname);
|
||||
|
||||
noteRevisionService.protectNoteRevisions(note);
|
||||
|
||||
return {
|
||||
uploaded: true
|
||||
};
|
||||
|
||||
@@ -97,7 +97,7 @@ function restoreNoteRevision(req) {
|
||||
if (noteRevision) {
|
||||
const note = noteRevision.getNote();
|
||||
|
||||
noteRevisionService.createNoteRevision(note);
|
||||
note.saveNoteRevision();
|
||||
|
||||
note.title = noteRevision.title;
|
||||
note.setContent(noteRevision.getContent());
|
||||
|
||||
@@ -53,11 +53,11 @@ function createNote(req) {
|
||||
};
|
||||
}
|
||||
|
||||
function updateNote(req) {
|
||||
const note = req.body;
|
||||
const noteId = req.params.noteId;
|
||||
function updateNoteContent(req) {
|
||||
const {content} = req.body;
|
||||
const {noteId} = req.params;
|
||||
|
||||
return noteService.updateNote(noteId, note);
|
||||
return noteService.updateNoteContent(noteId, content);
|
||||
}
|
||||
|
||||
function deleteNote(req) {
|
||||
@@ -294,7 +294,7 @@ function uploadModifiedFile(req) {
|
||||
|
||||
log.info(`Updating note '${noteId}' with content from ${filePath}`);
|
||||
|
||||
noteRevisionService.createNoteRevision(note);
|
||||
note.saveNoteRevision();
|
||||
|
||||
const fileContent = fs.readFileSync(filePath);
|
||||
|
||||
@@ -322,7 +322,7 @@ function getBacklinkCount(req) {
|
||||
|
||||
module.exports = {
|
||||
getNote,
|
||||
updateNote,
|
||||
updateNoteContent,
|
||||
deleteNote,
|
||||
undeleteNote,
|
||||
createNote,
|
||||
|
||||
Reference in New Issue
Block a user