mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-01-23 01:12:37 +00:00
NotesService.toNoteMetadataDto: Handle undefined updateUser
Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
f8efb9717e
commit
f9a0353748
1 changed files with 5 additions and 4 deletions
|
@ -356,10 +356,11 @@ export class NotesService {
|
|||
* @return {NoteMetadataDto} the built NoteMetadataDto
|
||||
*/
|
||||
async toNoteMetadataDto(note: Note): Promise<NoteMetadataDto> {
|
||||
const updateUser = await this.calculateUpdateUser(note);
|
||||
return {
|
||||
// TODO: Convert DB UUID to base64
|
||||
id: note.id,
|
||||
alias: note.alias,
|
||||
alias: note.alias ?? undefined,
|
||||
title: note.title ?? '',
|
||||
createTime: (await this.getFirstRevision(note)).createdAt,
|
||||
description: note.description ?? '',
|
||||
|
@ -369,9 +370,9 @@ export class NotesService {
|
|||
permissions: this.toNotePermissionsDto(note),
|
||||
tags: this.toTagList(note),
|
||||
updateTime: (await this.getLatestRevision(note)).createdAt,
|
||||
updateUser: this.usersService.toUserDto(
|
||||
await this.calculateUpdateUser(note),
|
||||
),
|
||||
updateUser: updateUser
|
||||
? this.usersService.toUserDto(updateUser)
|
||||
: undefined,
|
||||
viewCount: note.viewCount,
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue