feat(etapi): also save note revision via etapi if needed too (#6602)

This commit is contained in:
Elian Doran
2025-08-13 19:45:56 +03:00
committed by GitHub
2 changed files with 3 additions and 1 deletions

View File

@@ -29,7 +29,7 @@ describe("etapi/patch-note", () => {
})
.expect(201);
const createdNoteId = response.body.note.noteId as string;
createdNoteId = response.body.note.noteId as string;
expect(createdNoteId).toBeTruthy();
});

View File

@@ -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.`);
}
noteService.saveRevisionIfNeeded(note);
eu.validateAndPatch(note, req.body, ALLOWED_PROPERTIES_FOR_PATCH);
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.`);
}
noteService.saveRevisionIfNeeded(note);
note.setContent(req.body);
noteService.asyncPostProcessContent(note, req.body);