aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin/overview/users
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-04-17 09:21:02 +0200
committerChocobozzz <me@florianbigard.com>2023-04-17 09:21:02 +0200
commit208c97e111f2610880a588964bb61a03503cfcf6 (patch)
tree3ec04f25dec1411a284aa6e453d9e2cb460ce373 /client/src/app/+admin/overview/users
parent29ccdcb51f069d6a64744ffb216cb00ce4bf2d3d (diff)
downloadPeerTube-208c97e111f2610880a588964bb61a03503cfcf6.tar.gz
PeerTube-208c97e111f2610880a588964bb61a03503cfcf6.tar.zst
PeerTube-208c97e111f2610880a588964bb61a03503cfcf6.zip
Always translate user role
Diffstat (limited to 'client/src/app/+admin/overview/users')
-rw-r--r--client/src/app/+admin/overview/users/user-edit/user-edit.ts24
1 files changed, 14 insertions, 10 deletions
diff --git a/client/src/app/+admin/overview/users/user-edit/user-edit.ts b/client/src/app/+admin/overview/users/user-edit/user-edit.ts
index 1edca7fbf..5d6c6a91e 100644
--- a/client/src/app/+admin/overview/users/user-edit/user-edit.ts
+++ b/client/src/app/+admin/overview/users/user-edit/user-edit.ts
@@ -2,6 +2,7 @@ import { Directive, OnInit } from '@angular/core'
2import { ConfigService } from '@app/+admin/config/shared/config.service' 2import { ConfigService } from '@app/+admin/config/shared/config.service'
3import { AuthService, ScreenService, ServerService, User } from '@app/core' 3import { AuthService, ScreenService, ServerService, User } from '@app/core'
4import { FormReactive } from '@app/shared/shared-forms' 4import { FormReactive } from '@app/shared/shared-forms'
5import { peertubeTranslate } from '@shared/core-utils'
5import { USER_ROLE_LABELS } from '@shared/core-utils/users' 6import { USER_ROLE_LABELS } from '@shared/core-utils/users'
6import { HTMLServerConfig, UserAdminFlag, UserRole } from '@shared/models' 7import { HTMLServerConfig, UserAdminFlag, UserRole } from '@shared/models'
7import { SelectOptionsItem } from '../../../../../types/select-options-item.model' 8import { SelectOptionsItem } from '../../../../../types/select-options-item.model'
@@ -25,7 +26,7 @@ export abstract class UserEdit extends FormReactive implements OnInit {
25 abstract isCreation (): boolean 26 abstract isCreation (): boolean
26 abstract getFormButtonTitle (): string 27 abstract getFormButtonTitle (): string
27 28
28 ngOnInit (): void { 29 ngOnInit () {
29 this.serverConfig = this.serverService.getHTMLConfig() 30 this.serverConfig = this.serverService.getHTMLConfig()
30 31
31 this.buildRoles() 32 this.buildRoles()
@@ -49,15 +50,18 @@ export abstract class UserEdit extends FormReactive implements OnInit {
49 buildRoles () { 50 buildRoles () {
50 const authUser = this.auth.getUser() 51 const authUser = this.auth.getUser()
51 52
52 if (authUser.role.id === UserRole.ADMINISTRATOR) { 53 this.serverService.getServerLocale()
53 this.roles = Object.keys(USER_ROLE_LABELS) 54 .subscribe(translations => {
54 .map(key => ({ value: key.toString(), label: USER_ROLE_LABELS[key] })) 55 if (authUser.role.id === UserRole.ADMINISTRATOR) {
55 return 56 this.roles = Object.keys(USER_ROLE_LABELS)
56 } 57 .map(key => ({ value: key.toString(), label: peertubeTranslate(USER_ROLE_LABELS[key], translations) }))
57 58 return
58 this.roles = [ 59 }
59 { value: UserRole.USER.toString(), label: USER_ROLE_LABELS[UserRole.USER] } 60
60 ] 61 this.roles = [
62 { value: UserRole.USER.toString(), label: peertubeTranslate(USER_ROLE_LABELS[UserRole.USER], translations) }
63 ]
64 })
61 } 65 }
62 66
63 displayDangerZone () { 67 displayDangerZone () {