mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-13 14:44:43 -04:00
refactor(edit): lazy-load relations
Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
7f7886c5a7
commit
4e70044a2c
5 changed files with 26 additions and 20 deletions
|
@ -343,9 +343,11 @@ export class NotesService {
|
|||
if (lastRevision && lastRevision.edits) {
|
||||
// Sort the last Revisions Edits by their updatedAt Date to get the latest one
|
||||
// the user of that Edit is the updateUser
|
||||
return await lastRevision.edits.sort(
|
||||
(a, b) => b.updatedAt.getTime() - a.updatedAt.getTime(),
|
||||
)[0].author.user;
|
||||
return await (
|
||||
await lastRevision.edits.sort(
|
||||
(a, b) => b.updatedAt.getTime() - a.updatedAt.getTime(),
|
||||
)[0].author
|
||||
).user;
|
||||
}
|
||||
// If there are no Edits, the owner is the updateUser
|
||||
return await note.owner;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue