diff options
author | Chocobozzz <me@florianbigard.com> | 2021-06-04 13:31:41 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-06-04 15:45:44 +0200 |
commit | 2989628b7913383b39ac34c7db8666a21f8e5037 (patch) | |
tree | ac7759177c04e524e7845143fd685aefb49e810e /client/src/app/+admin/users | |
parent | 8e08d415f9473b6b72fef698729453e726da16e7 (diff) | |
download | PeerTube-2989628b7913383b39ac34c7db8666a21f8e5037.tar.gz PeerTube-2989628b7913383b39ac34c7db8666a21f8e5037.tar.zst PeerTube-2989628b7913383b39ac34c7db8666a21f8e5037.zip |
Use HTML config when possible
Diffstat (limited to 'client/src/app/+admin/users')
-rw-r--r-- | client/src/app/+admin/users/user-edit/user-edit.ts | 8 | ||||
-rw-r--r-- | client/src/app/+admin/users/user-list/user-list.component.ts | 12 | ||||
-rw-r--r-- | client/src/app/+admin/users/users.routes.ts | 5 |
3 files changed, 8 insertions, 17 deletions
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 2fc3c5d3b..ae1f79ba0 100644 --- a/client/src/app/+admin/users/user-edit/user-edit.ts +++ b/client/src/app/+admin/users/user-edit/user-edit.ts | |||
@@ -3,7 +3,7 @@ import { ConfigService } from '@app/+admin/config/shared/config.service' | |||
3 | import { AuthService, ScreenService, ServerService, User } from '@app/core' | 3 | import { AuthService, ScreenService, ServerService, User } from '@app/core' |
4 | import { FormReactive } from '@app/shared/shared-forms' | 4 | import { FormReactive } from '@app/shared/shared-forms' |
5 | import { USER_ROLE_LABELS } from '@shared/core-utils/users' | 5 | import { USER_ROLE_LABELS } from '@shared/core-utils/users' |
6 | import { ServerConfig, UserAdminFlag, UserRole, VideoResolution } from '@shared/models' | 6 | import { HTMLServerConfig, UserAdminFlag, UserRole, VideoResolution } from '@shared/models' |
7 | import { SelectOptionsItem } from '../../../../types/select-options-item.model' | 7 | import { SelectOptionsItem } from '../../../../types/select-options-item.model' |
8 | 8 | ||
9 | @Directive() | 9 | @Directive() |
@@ -16,7 +16,7 @@ export abstract class UserEdit extends FormReactive implements OnInit { | |||
16 | 16 | ||
17 | roles: { value: string, label: string }[] = [] | 17 | roles: { value: string, label: string }[] = [] |
18 | 18 | ||
19 | protected serverConfig: ServerConfig | 19 | protected serverConfig: HTMLServerConfig |
20 | 20 | ||
21 | protected abstract serverService: ServerService | 21 | protected abstract serverService: ServerService |
22 | protected abstract configService: ConfigService | 22 | protected abstract configService: ConfigService |
@@ -26,9 +26,7 @@ export abstract class UserEdit extends FormReactive implements OnInit { | |||
26 | abstract getFormButtonTitle (): string | 26 | abstract getFormButtonTitle (): string |
27 | 27 | ||
28 | ngOnInit (): void { | 28 | ngOnInit (): void { |
29 | this.serverConfig = this.serverService.getTmpConfig() | 29 | this.serverConfig = this.serverService.getHTMLConfig() |
30 | this.serverService.getConfig() | ||
31 | .subscribe(config => this.serverConfig = config) | ||
32 | 30 | ||
33 | this.buildRoles() | 31 | this.buildRoles() |
34 | } | 32 | } |
diff --git a/client/src/app/+admin/users/user-list/user-list.component.ts b/client/src/app/+admin/users/user-list/user-list.component.ts index 1c60adf89..e02d8e1ad 100644 --- a/client/src/app/+admin/users/user-list/user-list.component.ts +++ b/client/src/app/+admin/users/user-list/user-list.component.ts | |||
@@ -5,7 +5,7 @@ import { AuthService, ConfirmService, Notifier, RestPagination, RestTable, Serve | |||
5 | import { AdvancedInputFilter } from '@app/shared/shared-forms' | 5 | import { AdvancedInputFilter } from '@app/shared/shared-forms' |
6 | import { DropdownAction } from '@app/shared/shared-main' | 6 | import { DropdownAction } from '@app/shared/shared-main' |
7 | import { UserBanModalComponent } from '@app/shared/shared-moderation' | 7 | import { UserBanModalComponent } from '@app/shared/shared-moderation' |
8 | import { ServerConfig, User, UserRole } from '@shared/models' | 8 | import { User, UserRole } from '@shared/models' |
9 | 9 | ||
10 | type UserForList = User & { | 10 | type UserForList = User & { |
11 | rawVideoQuota: number | 11 | rawVideoQuota: number |
@@ -41,8 +41,9 @@ export class UserListComponent extends RestTable implements OnInit { | |||
41 | } | 41 | } |
42 | ] | 42 | ] |
43 | 43 | ||
44 | requiresEmailVerification = false | ||
45 | |||
44 | private _selectedColumns: string[] | 46 | private _selectedColumns: string[] |
45 | private serverConfig: ServerConfig | ||
46 | 47 | ||
47 | constructor ( | 48 | constructor ( |
48 | protected route: ActivatedRoute, | 49 | protected route: ActivatedRoute, |
@@ -60,10 +61,6 @@ export class UserListComponent extends RestTable implements OnInit { | |||
60 | return this.auth.getUser() | 61 | return this.auth.getUser() |
61 | } | 62 | } |
62 | 63 | ||
63 | get requiresEmailVerification () { | ||
64 | return this.serverConfig.signup.requiresEmailVerification | ||
65 | } | ||
66 | |||
67 | get selectedColumns () { | 64 | get selectedColumns () { |
68 | return this._selectedColumns | 65 | return this._selectedColumns |
69 | } | 66 | } |
@@ -73,9 +70,8 @@ export class UserListComponent extends RestTable implements OnInit { | |||
73 | } | 70 | } |
74 | 71 | ||
75 | ngOnInit () { | 72 | ngOnInit () { |
76 | this.serverConfig = this.serverService.getTmpConfig() | ||
77 | this.serverService.getConfig() | 73 | this.serverService.getConfig() |
78 | .subscribe(config => this.serverConfig = config) | 74 | .subscribe(config => this.requiresEmailVerification = config.signup.requiresEmailVerification) |
79 | 75 | ||
80 | this.initialize() | 76 | this.initialize() |
81 | 77 | ||
diff --git a/client/src/app/+admin/users/users.routes.ts b/client/src/app/+admin/users/users.routes.ts index 5183498d6..9175be067 100644 --- a/client/src/app/+admin/users/users.routes.ts +++ b/client/src/app/+admin/users/users.routes.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import { Routes } from '@angular/router' | 1 | import { Routes } from '@angular/router' |
2 | import { ServerConfigResolver, UserRightGuard } from '@app/core' | 2 | import { UserRightGuard } from '@app/core' |
3 | import { UserRight } from '@shared/models' | 3 | import { UserRight } from '@shared/models' |
4 | import { UserCreateComponent, UserUpdateComponent } from './user-edit' | 4 | import { UserCreateComponent, UserUpdateComponent } from './user-edit' |
5 | import { UserListComponent } from './user-list' | 5 | import { UserListComponent } from './user-list' |
@@ -35,9 +35,6 @@ export const UsersRoutes: Routes = [ | |||
35 | meta: { | 35 | meta: { |
36 | title: $localize`Create a user` | 36 | title: $localize`Create a user` |
37 | } | 37 | } |
38 | }, | ||
39 | resolve: { | ||
40 | serverConfig: ServerConfigResolver | ||
41 | } | 38 | } |
42 | }, | 39 | }, |
43 | { | 40 | { |