From: Chocobozzz Date: Wed, 18 Mar 2020 09:22:36 +0000 (+0100) Subject: Fix user role edition X-Git-Tag: v2.2.0-rc.1~360 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=a31bec51554261b1f67cdd4ebdb6afba4d8ee65a;p=oweals%2Fpeertube.git Fix user role edition --- diff --git a/client/src/app/+admin/users/user-edit/user-edit.component.html b/client/src/app/+admin/users/user-edit/user-edit.component.html index 2aca5ddca..dbb0e36b9 100644 --- a/client/src/app/+admin/users/user-edit/user-edit.component.html +++ b/client/src/app/+admin/users/user-edit/user-edit.component.html @@ -49,7 +49,7 @@
diff --git a/client/src/app/+admin/users/user-edit/user-edit.ts b/client/src/app/+admin/users/user-edit/user-edit.ts index 02f1dcd42..47b57d2ec 100644 --- a/client/src/app/+admin/users/user-edit/user-edit.ts +++ b/client/src/app/+admin/users/user-edit/user-edit.ts @@ -11,6 +11,8 @@ export abstract class UserEdit extends FormReactive implements OnInit { username: string userId: number + roles: { value: string, label: string }[] = [] + protected serverConfig: ServerConfig protected abstract serverService: ServerService @@ -23,17 +25,20 @@ export abstract class UserEdit extends FormReactive implements OnInit { this.serverConfig = this.serverService.getTmpConfig() this.serverService.getConfig() .subscribe(config => this.serverConfig = config) + + this.buildRoles() } - getRoles () { + buildRoles () { const authUser = this.auth.getUser() if (authUser.role === UserRole.ADMINISTRATOR) { - return Object.keys(USER_ROLE_LABELS) + this.roles = Object.keys(USER_ROLE_LABELS) .map(key => ({ value: key.toString(), label: USER_ROLE_LABELS[key] })) + return } - return [ + this.roles = [ { value: UserRole.USER.toString(), label: USER_ROLE_LABELS[UserRole.USER] } ] }