upd: store old date and use it in previous versions

This commit is contained in:
Mar0xy 2023-10-22 14:07:04 +02:00
parent 2706b6b618
commit 83be996a3d
No known key found for this signature in database
GPG key ID: 56569BBE47D2C828
6 changed files with 27 additions and 6 deletions

View file

@ -388,6 +388,8 @@ export class NoteEditService implements OnApplicationShutdown {
}
if (Object.keys(update).length > 0) {
const exists = await this.noteEditRepository.findOneBy({ noteId: oldnote.id });
await this.noteEditRepository.insert({
id: this.idService.gen(),
noteId: oldnote.id,
@ -395,6 +397,7 @@ export class NoteEditService implements OnApplicationShutdown {
newText: update.text || undefined,
cw: update.cw || undefined,
fileIds: undefined,
oldDate: exists ? oldnote.updatedAt as Date : this.idService.parse(oldnote.id).date,
updatedAt: new Date(),
});