Merge branch 'fix/10868' into 'develop'

fix: #10868 incorrect text inserted to note_edit

Co-authored-by: Lhcfl <Lhcfl@outlook.com>

Closes #10868

See merge request firefish/firefish!10712
This commit is contained in:
naskya 2024-03-25 17:02:02 +00:00
commit f9f495b035
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(),
});