Skip to content

Commit 384a89b

Browse files
authored
feat(etapi): also save note revision via etapi if needed too (#6602)
2 parents aa83429 + e7fd937 commit 384a89b

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

apps/server/spec/etapi/patch-note.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ describe("etapi/patch-note", () => {
2929
})
3030
.expect(201);
3131

32-
const createdNoteId = response.body.note.noteId as string;
32+
createdNoteId = response.body.note.noteId as string;
3333
expect(createdNoteId).toBeTruthy();
3434
});
3535

apps/server/src/etapi/notes.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ function register(router: Router) {
9292
throw new eu.EtapiError(400, "NOTE_IS_PROTECTED", `Note '${req.params.noteId}' is protected and cannot be modified through ETAPI.`);
9393
}
9494

95+
noteService.saveRevisionIfNeeded(note);
9596
eu.validateAndPatch(note, req.body, ALLOWED_PROPERTIES_FOR_PATCH);
9697
note.save();
9798

@@ -136,6 +137,7 @@ function register(router: Router) {
136137
throw new eu.EtapiError(400, "NOTE_IS_PROTECTED", `Note '${req.params.noteId}' is protected and cannot be modified through ETAPI.`);
137138
}
138139

140+
noteService.saveRevisionIfNeeded(note);
139141
note.setContent(req.body);
140142

141143
noteService.asyncPostProcessContent(note, req.body);

0 commit comments

Comments
 (0)