diff options
Diffstat (limited to 'client/src/app/+admin/users/user-edit/user-edit.ts')
-rw-r--r-- | client/src/app/+admin/users/user-edit/user-edit.ts | 19 |
1 files changed, 18 insertions, 1 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 47b57d2ec..a23cd9033 100644 --- a/client/src/app/+admin/users/user-edit/user-edit.ts +++ b/client/src/app/+admin/users/user-edit/user-edit.ts | |||
@@ -4,12 +4,14 @@ import { ServerConfig, USER_ROLE_LABELS, UserRole, VideoResolution } from '../.. | |||
4 | import { ConfigService } from '@app/+admin/config/shared/config.service' | 4 | import { ConfigService } from '@app/+admin/config/shared/config.service' |
5 | import { UserAdminFlag } from '@shared/models/users/user-flag.model' | 5 | import { UserAdminFlag } from '@shared/models/users/user-flag.model' |
6 | import { OnInit } from '@angular/core' | 6 | import { OnInit } from '@angular/core' |
7 | import { User } from '@app/shared/users/user.model' | ||
8 | import { ScreenService } from '@app/shared/misc/screen.service' | ||
7 | 9 | ||
8 | export abstract class UserEdit extends FormReactive implements OnInit { | 10 | export abstract class UserEdit extends FormReactive implements OnInit { |
9 | videoQuotaOptions: { value: string, label: string }[] = [] | 11 | videoQuotaOptions: { value: string, label: string }[] = [] |
10 | videoQuotaDailyOptions: { value: string, label: string }[] = [] | 12 | videoQuotaDailyOptions: { value: string, label: string }[] = [] |
11 | username: string | 13 | username: string |
12 | userId: number | 14 | user: User |
13 | 15 | ||
14 | roles: { value: string, label: string }[] = [] | 16 | roles: { value: string, label: string }[] = [] |
15 | 17 | ||
@@ -17,6 +19,7 @@ export abstract class UserEdit extends FormReactive implements OnInit { | |||
17 | 19 | ||
18 | protected abstract serverService: ServerService | 20 | protected abstract serverService: ServerService |
19 | protected abstract configService: ConfigService | 21 | protected abstract configService: ConfigService |
22 | protected abstract screenService: ScreenService | ||
20 | protected abstract auth: AuthService | 23 | protected abstract auth: AuthService |
21 | abstract isCreation (): boolean | 24 | abstract isCreation (): boolean |
22 | abstract getFormButtonTitle (): string | 25 | abstract getFormButtonTitle (): string |
@@ -29,6 +32,20 @@ export abstract class UserEdit extends FormReactive implements OnInit { | |||
29 | this.buildRoles() | 32 | this.buildRoles() |
30 | } | 33 | } |
31 | 34 | ||
35 | get subscribersCount () { | ||
36 | const forAccount = this.user | ||
37 | ? this.user.account.followersCount | ||
38 | : 0 | ||
39 | const forChannels = this.user | ||
40 | ? this.user.videoChannels.map(c => c.followersCount).reduce((a, b) => a + b, 0) | ||
41 | : 0 | ||
42 | return forAccount + forChannels | ||
43 | } | ||
44 | |||
45 | isInBigView () { | ||
46 | return this.screenService.getWindowInnerWidth() > 1600 | ||
47 | } | ||
48 | |||
32 | buildRoles () { | 49 | buildRoles () { |
33 | const authUser = this.auth.getUser() | 50 | const authUser = this.auth.getUser() |
34 | 51 | ||