fix: #10868 incorrect text inserted to note_edit

Co-authored-by: Lhcfl <Lhcfl@outlook.com>
This commit is contained in:
Linca 2024-03-25 17:02:02 +00:00 committed by naskya
parent 17cd5ecfc2
commit 72d5e4cdb8
2 changed files with 5 additions and 5 deletions

View file

@ -296,7 +296,7 @@ export class Note {
nullable: true,
comment: "The updated date of the Note.",
})
public updatedAt: Date;
public updatedAt: Date | null;
//#endregion
constructor(data: Partial<Note>) {

View file

@ -606,13 +606,13 @@ export default define(meta, paramDef, async (ps, user) => {
update.updatedAt = new Date();
await Notes.update(note.id, update);
// Add NoteEdit history
// Add NoteEdit history for the previous one
await NoteEdits.insert({
id: genId(),
noteId: note.id,
text: ps.text || undefined,
cw: ps.cw,
fileIds: ps.fileIds,
text: note.text || undefined,
cw: note.cw,
fileIds: note.fileIds,
updatedAt: new Date(),
});