mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-27 03:58:02 -05:00
NotesService: toNotePermissionsDto does not need to be async
Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
b5281991ef
commit
d8d105ed75
2 changed files with 3 additions and 4 deletions
|
@ -221,7 +221,7 @@ export class NotesController {
|
||||||
if (!this.permissionsService.isOwner(req.user, note)) {
|
if (!this.permissionsService.isOwner(req.user, note)) {
|
||||||
throw new UnauthorizedException('Updating note denied!');
|
throw new UnauthorizedException('Updating note denied!');
|
||||||
}
|
}
|
||||||
return await this.noteService.toNotePermissionsDto(
|
return this.noteService.toNotePermissionsDto(
|
||||||
this.noteService.updateNotePermissions(note, updateDto),
|
this.noteService.updateNotePermissions(note, updateDto),
|
||||||
);
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
@ -295,12 +295,11 @@ export class NotesService {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @async
|
|
||||||
* Build NotePermissionsDto from a note.
|
* Build NotePermissionsDto from a note.
|
||||||
* @param {Note} note - the note to use
|
* @param {Note} note - the note to use
|
||||||
* @return {NotePermissionsDto} the built NotePermissionDto
|
* @return {NotePermissionsDto} the built NotePermissionDto
|
||||||
*/
|
*/
|
||||||
async toNotePermissionsDto(note: Note): Promise<NotePermissionsDto> {
|
toNotePermissionsDto(note: Note): Promise<NotePermissionsDto> {
|
||||||
return {
|
return {
|
||||||
owner: this.usersService.toUserDto(note.owner),
|
owner: this.usersService.toUserDto(note.owner),
|
||||||
sharedToUsers: note.userPermissions.map((noteUserPermission) => ({
|
sharedToUsers: note.userPermissions.map((noteUserPermission) => ({
|
||||||
|
@ -331,7 +330,7 @@ export class NotesService {
|
||||||
editedBy: note.authorColors.map(
|
editedBy: note.authorColors.map(
|
||||||
(authorColor) => authorColor.user.userName,
|
(authorColor) => authorColor.user.userName,
|
||||||
),
|
),
|
||||||
permissions: await this.toNotePermissionsDto(note),
|
permissions: this.toNotePermissionsDto(note),
|
||||||
tags: this.toTagList(note),
|
tags: this.toTagList(note),
|
||||||
updateTime: (await this.getLatestRevision(note)).createdAt,
|
updateTime: (await this.getLatestRevision(note)).createdAt,
|
||||||
updateUser: this.usersService.toUserDto(
|
updateUser: this.usersService.toUserDto(
|
||||||
|
|
Loading…
Reference in a new issue