upd: add additional checks
This commit is contained in:
parent
b43402519f
commit
d49099baeb
2 changed files with 4 additions and 4 deletions
|
@ -50,13 +50,13 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
|
|
||||||
for (const edit of edits) {
|
for (const edit of edits) {
|
||||||
editArray.push({
|
editArray.push({
|
||||||
oldDate: edit.oldDate,
|
oldDate: edit.oldDate as Date | null ?? null,
|
||||||
updatedAt: edit.updatedAt,
|
updatedAt: edit.updatedAt,
|
||||||
text: edit.oldText,
|
text: edit.oldText ?? edit.newText ?? null,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
editArray = editArray.sort((a, b) => { return new Date(b.oldDate).getTime() - new Date(a.oldDate).getTime(); });
|
editArray = editArray.sort((a, b) => { return new Date(b.oldDate ?? b.updatedAt).getTime() - new Date(a.oldDate ?? a.updatedAt).getTime(); });
|
||||||
|
|
||||||
return editArray;
|
return editArray;
|
||||||
});
|
});
|
||||||
|
|
|
@ -120,7 +120,7 @@ if (noteViewInterruptors.length > 0) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const replaceContent = () => {
|
const replaceContent = () => {
|
||||||
note.text = props.oldText;
|
props.oldText ? note.text = props.oldText : undefined;
|
||||||
note.createdAt = props.updatedAt;
|
note.createdAt = props.updatedAt;
|
||||||
};
|
};
|
||||||
replaceContent();
|
replaceContent();
|
||||||
|
|
Loading…
Reference in a new issue