mirror of
https://github.com/zadam/trilium.git
synced 2025-10-06 05:25:37 +08:00
feat(etapi): also save note revision via etapi if needed too (#6602)
This commit is contained in:
commit
384a89b0e3
2 changed files with 3 additions and 1 deletions
|
@ -29,7 +29,7 @@ describe("etapi/patch-note", () => {
|
||||||
})
|
})
|
||||||
.expect(201);
|
.expect(201);
|
||||||
|
|
||||||
const createdNoteId = response.body.note.noteId as string;
|
createdNoteId = response.body.note.noteId as string;
|
||||||
expect(createdNoteId).toBeTruthy();
|
expect(createdNoteId).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -92,6 +92,7 @@ function register(router: Router) {
|
||||||
throw new eu.EtapiError(400, "NOTE_IS_PROTECTED", `Note '${req.params.noteId}' is protected and cannot be modified through ETAPI.`);
|
throw new eu.EtapiError(400, "NOTE_IS_PROTECTED", `Note '${req.params.noteId}' is protected and cannot be modified through ETAPI.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
noteService.saveRevisionIfNeeded(note);
|
||||||
eu.validateAndPatch(note, req.body, ALLOWED_PROPERTIES_FOR_PATCH);
|
eu.validateAndPatch(note, req.body, ALLOWED_PROPERTIES_FOR_PATCH);
|
||||||
note.save();
|
note.save();
|
||||||
|
|
||||||
|
@ -136,6 +137,7 @@ function register(router: Router) {
|
||||||
throw new eu.EtapiError(400, "NOTE_IS_PROTECTED", `Note '${req.params.noteId}' is protected and cannot be modified through ETAPI.`);
|
throw new eu.EtapiError(400, "NOTE_IS_PROTECTED", `Note '${req.params.noteId}' is protected and cannot be modified through ETAPI.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
noteService.saveRevisionIfNeeded(note);
|
||||||
note.setContent(req.body);
|
note.setContent(req.body);
|
||||||
|
|
||||||
noteService.asyncPostProcessContent(note, req.body);
|
noteService.asyncPostProcessContent(note, req.body);
|
||||||
|
|
Loading…
Add table
Reference in a new issue