aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src
diff options
context:
space:
mode:
Diffstat (limited to 'client/src')
-rw-r--r--client/src/app/+admin/users/user-edit/user-create.component.ts7
-rw-r--r--client/src/app/+admin/users/user-edit/user-edit.component.html7
-rw-r--r--client/src/app/+admin/users/user-edit/user-edit.ts5
-rw-r--r--client/src/app/+admin/users/user-edit/user-update.component.ts8
-rw-r--r--client/src/app/shared/users/user-notifications.component.html2
-rw-r--r--client/src/app/shared/users/user.model.ts11
6 files changed, 35 insertions, 5 deletions
diff --git a/client/src/app/+admin/users/user-edit/user-create.component.ts b/client/src/app/+admin/users/user-edit/user-create.component.ts
index 137ecfcbd..9a6801806 100644
--- a/client/src/app/+admin/users/user-edit/user-create.component.ts
+++ b/client/src/app/+admin/users/user-edit/user-create.component.ts
@@ -8,6 +8,7 @@ import { FormValidatorService } from '@app/shared/forms/form-validators/form-val
8import { UserValidatorsService } from '@app/shared/forms/form-validators/user-validators.service' 8import { UserValidatorsService } from '@app/shared/forms/form-validators/user-validators.service'
9import { ConfigService } from '@app/+admin/config/shared/config.service' 9import { ConfigService } from '@app/+admin/config/shared/config.service'
10import { UserService } from '@app/shared' 10import { UserService } from '@app/shared'
11import { UserAdminFlag } from '@shared/models/users/user-flag.model'
11 12
12@Component({ 13@Component({
13 selector: 'my-user-create', 14 selector: 'my-user-create',
@@ -45,7 +46,8 @@ export class UserCreateComponent extends UserEdit implements OnInit {
45 password: this.userValidatorsService.USER_PASSWORD, 46 password: this.userValidatorsService.USER_PASSWORD,
46 role: this.userValidatorsService.USER_ROLE, 47 role: this.userValidatorsService.USER_ROLE,
47 videoQuota: this.userValidatorsService.USER_VIDEO_QUOTA, 48 videoQuota: this.userValidatorsService.USER_VIDEO_QUOTA,
48 videoQuotaDaily: this.userValidatorsService.USER_VIDEO_QUOTA_DAILY 49 videoQuotaDaily: this.userValidatorsService.USER_VIDEO_QUOTA_DAILY,
50 byPassAutoBlacklist: null
49 }, defaultValues) 51 }, defaultValues)
50 } 52 }
51 53
@@ -54,8 +56,11 @@ export class UserCreateComponent extends UserEdit implements OnInit {
54 56
55 const userCreate: UserCreate = this.form.value 57 const userCreate: UserCreate = this.form.value
56 58
59 userCreate.adminFlags = this.buildAdminFlags(this.form.value)
60
57 // A select in HTML is always mapped as a string, we convert it to number 61 // A select in HTML is always mapped as a string, we convert it to number
58 userCreate.videoQuota = parseInt(this.form.value['videoQuota'], 10) 62 userCreate.videoQuota = parseInt(this.form.value['videoQuota'], 10)
63 userCreate.videoQuotaDaily = parseInt(this.form.value['videoQuotaDaily'], 10)
59 64
60 this.userService.addUser(userCreate).subscribe( 65 this.userService.addUser(userCreate).subscribe(
61 () => { 66 () => {
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 c6566da24..400bac5d4 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
@@ -79,6 +79,13 @@
79 </div> 79 </div>
80 </div> 80 </div>
81 81
82 <div class="form-group">
83 <my-peertube-checkbox
84 inputName="byPassAutoBlacklist" formControlName="byPassAutoBlacklist"
85 i18n-labelText labelText="Bypass video auto blacklist"
86 ></my-peertube-checkbox>
87 </div>
88
82 <input type="submit" value="{{ getFormButtonTitle() }}" [disabled]="!form.valid"> 89 <input type="submit" value="{{ getFormButtonTitle() }}" [disabled]="!form.valid">
83</form> 90</form>
84 91
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 649b35b0c..adce1b2d4 100644
--- a/client/src/app/+admin/users/user-edit/user-edit.ts
+++ b/client/src/app/+admin/users/user-edit/user-edit.ts
@@ -2,6 +2,7 @@ import { ServerService } from '../../../core'
2import { FormReactive } from '../../../shared' 2import { FormReactive } from '../../../shared'
3import { USER_ROLE_LABELS, VideoResolution } from '../../../../../../shared' 3import { USER_ROLE_LABELS, VideoResolution } from '../../../../../../shared'
4import { ConfigService } from '@app/+admin/config/shared/config.service' 4import { ConfigService } from '@app/+admin/config/shared/config.service'
5import { UserAdminFlag } from '@shared/models/users/user-flag.model'
5 6
6export abstract class UserEdit extends FormReactive { 7export abstract class UserEdit extends FormReactive {
7 videoQuotaOptions: { value: string, label: string }[] = [] 8 videoQuotaOptions: { value: string, label: string }[] = []
@@ -42,6 +43,10 @@ export abstract class UserEdit extends FormReactive {
42 return 43 return
43 } 44 }
44 45
46 protected buildAdminFlags (formValue: any) {
47 return formValue.byPassAutoBlacklist ? UserAdminFlag.BY_PASS_VIDEO_AUTO_BLACKLIST : UserAdminFlag.NONE
48 }
49
45 protected buildQuotaOptions () { 50 protected buildQuotaOptions () {
46 // These are used by a HTML select, so convert key into strings 51 // These are used by a HTML select, so convert key into strings
47 this.videoQuotaOptions = this.configService 52 this.videoQuotaOptions = this.configService
diff --git a/client/src/app/+admin/users/user-edit/user-update.component.ts b/client/src/app/+admin/users/user-edit/user-update.component.ts
index 94ef87b08..04b2935f4 100644
--- a/client/src/app/+admin/users/user-edit/user-update.component.ts
+++ b/client/src/app/+admin/users/user-edit/user-update.component.ts
@@ -10,6 +10,7 @@ import { FormValidatorService } from '@app/shared/forms/form-validators/form-val
10import { UserValidatorsService } from '@app/shared/forms/form-validators/user-validators.service' 10import { UserValidatorsService } from '@app/shared/forms/form-validators/user-validators.service'
11import { ConfigService } from '@app/+admin/config/shared/config.service' 11import { ConfigService } from '@app/+admin/config/shared/config.service'
12import { UserService } from '@app/shared' 12import { UserService } from '@app/shared'
13import { UserAdminFlag } from '@shared/models/users/user-flag.model'
13 14
14@Component({ 15@Component({
15 selector: 'my-user-update', 16 selector: 'my-user-update',
@@ -46,7 +47,8 @@ export class UserUpdateComponent extends UserEdit implements OnInit, OnDestroy {
46 email: this.userValidatorsService.USER_EMAIL, 47 email: this.userValidatorsService.USER_EMAIL,
47 role: this.userValidatorsService.USER_ROLE, 48 role: this.userValidatorsService.USER_ROLE,
48 videoQuota: this.userValidatorsService.USER_VIDEO_QUOTA, 49 videoQuota: this.userValidatorsService.USER_VIDEO_QUOTA,
49 videoQuotaDaily: this.userValidatorsService.USER_VIDEO_QUOTA_DAILY 50 videoQuotaDaily: this.userValidatorsService.USER_VIDEO_QUOTA_DAILY,
51 byPassAutoBlacklist: null
50 }, defaultValues) 52 }, defaultValues)
51 53
52 this.paramsSub = this.route.params.subscribe(routeParams => { 54 this.paramsSub = this.route.params.subscribe(routeParams => {
@@ -67,6 +69,7 @@ export class UserUpdateComponent extends UserEdit implements OnInit, OnDestroy {
67 this.error = undefined 69 this.error = undefined
68 70
69 const userUpdate: UserUpdate = this.form.value 71 const userUpdate: UserUpdate = this.form.value
72 userUpdate.adminFlags = this.buildAdminFlags(this.form.value)
70 73
71 // A select in HTML is always mapped as a string, we convert it to number 74 // A select in HTML is always mapped as a string, we convert it to number
72 userUpdate.videoQuota = parseInt(this.form.value['videoQuota'], 10) 75 userUpdate.videoQuota = parseInt(this.form.value['videoQuota'], 10)
@@ -111,7 +114,8 @@ export class UserUpdateComponent extends UserEdit implements OnInit, OnDestroy {
111 email: userJson.email, 114 email: userJson.email,
112 role: userJson.role, 115 role: userJson.role,
113 videoQuota: userJson.videoQuota, 116 videoQuota: userJson.videoQuota,
114 videoQuotaDaily: userJson.videoQuotaDaily 117 videoQuotaDaily: userJson.videoQuotaDaily,
118 byPassAutoBlacklist: userJson.adminFlags & UserAdminFlag.BY_PASS_VIDEO_AUTO_BLACKLIST
115 }) 119 })
116 } 120 }
117} 121}
diff --git a/client/src/app/shared/users/user-notifications.component.html b/client/src/app/shared/users/user-notifications.component.html
index d27f60158..d0d9d9f35 100644
--- a/client/src/app/shared/users/user-notifications.component.html
+++ b/client/src/app/shared/users/user-notifications.component.html
@@ -107,7 +107,7 @@
107 <my-global-icon iconName="users"></my-global-icon> 107 <my-global-icon iconName="users"></my-global-icon>
108 108
109 <div class="message"> 109 <div class="message">
110 Your instance has <a (click)="markAsRead(notification)" [routerLink]="notification.instanceFollowUrl">a new follower</a> 110 Your instance has <a (click)="markAsRead(notification)" [routerLink]="notification.instanceFollowUrl">a new follower</a> ({{ notification.actorFollow.follower.host }})
111 <ng-container *ngIf="notification.actorFollow.state === 'pending'"> awaiting your approval</ng-container> 111 <ng-container *ngIf="notification.actorFollow.state === 'pending'"> awaiting your approval</ng-container>
112 </div> 112 </div>
113 </ng-container> 113 </ng-container>
diff --git a/client/src/app/shared/users/user.model.ts b/client/src/app/shared/users/user.model.ts
index c15f1de8c..e3ed2dfbd 100644
--- a/client/src/app/shared/users/user.model.ts
+++ b/client/src/app/shared/users/user.model.ts
@@ -2,15 +2,18 @@ import { hasUserRight, User as UserServerModel, UserNotificationSetting, UserRig
2import { NSFWPolicyType } from '../../../../../shared/models/videos/nsfw-policy.type' 2import { NSFWPolicyType } from '../../../../../shared/models/videos/nsfw-policy.type'
3import { Account } from '@app/shared/account/account.model' 3import { Account } from '@app/shared/account/account.model'
4import { Avatar } from '../../../../../shared/models/avatars/avatar.model' 4import { Avatar } from '../../../../../shared/models/avatars/avatar.model'
5import { UserAdminFlag } from '@shared/models/users/user-flag.model'
5 6
6export class User implements UserServerModel { 7export class User implements UserServerModel {
7 id: number 8 id: number
8 username: string 9 username: string
9 email: string 10 email: string
10 emailVerified: boolean 11 emailVerified: boolean
11 role: UserRole
12 nsfwPolicy: NSFWPolicyType 12 nsfwPolicy: NSFWPolicyType
13 13
14 role: UserRole
15 roleLabel: string
16
14 webTorrentEnabled: boolean 17 webTorrentEnabled: boolean
15 autoPlayVideo: boolean 18 autoPlayVideo: boolean
16 videosHistoryEnabled: boolean 19 videosHistoryEnabled: boolean
@@ -21,6 +24,8 @@ export class User implements UserServerModel {
21 videoChannels: VideoChannel[] 24 videoChannels: VideoChannel[]
22 createdAt: Date 25 createdAt: Date
23 26
27 adminFlags?: UserAdminFlag
28
24 blocked: boolean 29 blocked: boolean
25 blockedReason?: string 30 blockedReason?: string
26 31
@@ -30,6 +35,7 @@ export class User implements UserServerModel {
30 this.id = hash.id 35 this.id = hash.id
31 this.username = hash.username 36 this.username = hash.username
32 this.email = hash.email 37 this.email = hash.email
38
33 this.role = hash.role 39 this.role = hash.role
34 40
35 this.videoChannels = hash.videoChannels 41 this.videoChannels = hash.videoChannels
@@ -40,6 +46,9 @@ export class User implements UserServerModel {
40 this.videosHistoryEnabled = hash.videosHistoryEnabled 46 this.videosHistoryEnabled = hash.videosHistoryEnabled
41 this.autoPlayVideo = hash.autoPlayVideo 47 this.autoPlayVideo = hash.autoPlayVideo
42 this.createdAt = hash.createdAt 48 this.createdAt = hash.createdAt
49
50 this.adminFlags = hash.adminFlags
51
43 this.blocked = hash.blocked 52 this.blocked = hash.blocked
44 this.blockedReason = hash.blockedReason 53 this.blockedReason = hash.blockedReason
45 54