mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-21 17:26:29 -05:00
fix(backend): fix extraction body values in permission controllers
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
f87a7e1e69
commit
a5e12b9ad0
4 changed files with 7 additions and 7 deletions
|
@ -205,7 +205,7 @@ export class NotesController {
|
|||
@RequestUser() user: User,
|
||||
@RequestNote() note: Note,
|
||||
@Param('userName') username: string,
|
||||
@Body() canEdit: boolean,
|
||||
@Body('canEdit') canEdit: boolean,
|
||||
): Promise<NotePermissionsDto> {
|
||||
const permissionUser = await this.userService.getUserByUsername(username);
|
||||
const returnedNote = await this.permissionService.setUserPermission(
|
||||
|
@ -285,7 +285,7 @@ export class NotesController {
|
|||
async changeOwner(
|
||||
@RequestUser() user: User,
|
||||
@RequestNote() note: Note,
|
||||
@Body() newOwner: string,
|
||||
@Body('newOwner') newOwner: string,
|
||||
): Promise<NoteDto> {
|
||||
const owner = await this.userService.getUserByUsername(newOwner);
|
||||
return await this.noteService.toNoteDto(
|
||||
|
|
|
@ -384,7 +384,7 @@ export class NotesController {
|
|||
async changeOwner(
|
||||
@RequestUser() user: User,
|
||||
@RequestNote() note: Note,
|
||||
@Body() newOwner: string,
|
||||
@Body('newOwner') newOwner: string,
|
||||
): Promise<NoteDto> {
|
||||
const owner = await this.userService.getUserByUsername(newOwner);
|
||||
return await this.noteService.toNoteDto(
|
||||
|
|
|
@ -12,16 +12,16 @@ import type { NotePermissions } from '@hedgedoc/commons'
|
|||
* Sets the owner of a note.
|
||||
*
|
||||
* @param noteId The id of the note.
|
||||
* @param owner The username of the new owner.
|
||||
* @param newOwner The username of the new owner.
|
||||
* @return The updated {@link NotePermissions}.
|
||||
* @throws {Error} when the api request wasn't successful.
|
||||
*/
|
||||
export const setNoteOwner = async (noteId: string, owner: string): Promise<NotePermissions> => {
|
||||
export const setNoteOwner = async (noteId: string, newOwner: string): Promise<NotePermissions> => {
|
||||
const response = await new PutApiRequestBuilder<NotePermissions, OwnerChangeDto>(
|
||||
`notes/${noteId}/metadata/permissions/owner`
|
||||
)
|
||||
.withJsonBody({
|
||||
owner
|
||||
newOwner
|
||||
})
|
||||
.sendRequest()
|
||||
return response.asParsedJsonObject()
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
export interface OwnerChangeDto {
|
||||
owner: string
|
||||
newOwner: string
|
||||
}
|
||||
|
||||
export interface PermissionSetDto {
|
||||
|
|
Loading…
Reference in a new issue