mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-19 01:35:18 -04:00
refactor(author): lazy-load relations
Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
552d06f182
commit
244e3f76ea
4 changed files with 10 additions and 10 deletions
|
@ -703,7 +703,7 @@ describe('NotesService', () => {
|
|||
it('works', async () => {
|
||||
const user = User.create('hardcoded', 'Testy') as User;
|
||||
const author = Author.create(1);
|
||||
author.user = user;
|
||||
author.user = Promise.resolve(user);
|
||||
const group = Group.create('testGroup', 'testGroup', false) as Group;
|
||||
const content = 'testContent';
|
||||
jest
|
||||
|
@ -798,7 +798,7 @@ describe('NotesService', () => {
|
|||
it('works', async () => {
|
||||
const user = User.create('hardcoded', 'Testy') as User;
|
||||
const author = Author.create(1);
|
||||
author.user = user;
|
||||
author.user = Promise.resolve(user);
|
||||
const otherUser = User.create('other hardcoded', 'Testy2') as User;
|
||||
otherUser.username = 'other hardcoded user';
|
||||
const group = Group.create('testGroup', 'testGroup', false) as Group;
|
||||
|
|
|
@ -343,7 +343,7 @@ 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 lastRevision.edits.sort(
|
||||
return await lastRevision.edits.sort(
|
||||
(a, b) => b.updatedAt.getTime() - a.updatedAt.getTime(),
|
||||
)[0].author.user;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue