aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--client/src/app/+admin/admin.component.ts2
-rw-r--r--client/src/app/+admin/moderation/moderation.component.ts2
-rw-r--r--client/src/app/+admin/moderation/moderation.routes.ts2
-rw-r--r--client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts4
-rw-r--r--client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts14
-rw-r--r--client/src/app/+admin/users/user-edit/user-create.component.ts2
-rw-r--r--client/src/app/+admin/users/user-edit/user-edit.component.html2
-rw-r--r--client/src/app/+admin/users/user-edit/user-edit.ts2
-rw-r--r--client/src/app/+admin/users/user-edit/user-update.component.ts4
-rw-r--r--client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.ts2
-rw-r--r--client/src/app/menu/menu.component.ts4
-rw-r--r--client/src/app/shared/users/user-notification.model.ts6
-rw-r--r--client/src/app/shared/users/user-notifications.component.html8
-rw-r--r--client/src/app/shared/video-block/video-block.service.ts12
-rw-r--r--client/src/app/shared/video/video.model.ts4
-rw-r--r--client/src/app/videos/+video-watch/video-watch.component.ts4
-rw-r--r--server/controllers/api/videos/blacklist.ts8
-rw-r--r--server/helpers/custom-validators/video-blacklist.ts4
-rw-r--r--server/initializers/migrations/0350-video-blacklist-type.ts4
-rw-r--r--server/lib/notifier.ts8
-rw-r--r--server/lib/video-blacklist.ts10
-rw-r--r--server/models/account/user.ts4
-rw-r--r--server/models/video/video-blacklist.ts8
-rw-r--r--server/tests/api/check-params/users.ts2
-rw-r--r--server/tests/api/check-params/video-blacklist.ts4
-rw-r--r--server/tests/api/users/users.ts4
-rw-r--r--server/tests/api/videos/video-blacklist.ts20
-rw-r--r--shared/extra-utils/users/user-notifications.ts6
-rw-r--r--shared/extra-utils/videos/video-blacklist.ts4
-rw-r--r--shared/models/users/user-flag.model.ts2
-rw-r--r--shared/models/users/user-notification.model.ts6
-rw-r--r--shared/models/users/user-right.enum.ts2
-rw-r--r--shared/models/users/user-role.ts2
-rw-r--r--shared/models/videos/blacklist/video-blacklist.model.ts6
34 files changed, 89 insertions, 89 deletions
diff --git a/client/src/app/+admin/admin.component.ts b/client/src/app/+admin/admin.component.ts
index 4cf3da0e8..a97a33cf5 100644
--- a/client/src/app/+admin/admin.component.ts
+++ b/client/src/app/+admin/admin.component.ts
@@ -37,7 +37,7 @@ export class AdminComponent implements OnInit {
37 } 37 }
38 38
39 hasVideoBlocklistRight () { 39 hasVideoBlocklistRight () {
40 return this.auth.getUser().hasRight(UserRight.MANAGE_VIDEO_BLOCKS) 40 return this.auth.getUser().hasRight(UserRight.MANAGE_VIDEO_BLACKLIST)
41 } 41 }
42 42
43 hasConfigRight () { 43 hasConfigRight () {
diff --git a/client/src/app/+admin/moderation/moderation.component.ts b/client/src/app/+admin/moderation/moderation.component.ts
index d48305eed..1b1df6f09 100644
--- a/client/src/app/+admin/moderation/moderation.component.ts
+++ b/client/src/app/+admin/moderation/moderation.component.ts
@@ -25,7 +25,7 @@ export class ModerationComponent implements OnInit {
25 } 25 }
26 26
27 hasVideoBlocklistRight () { 27 hasVideoBlocklistRight () {
28 return this.auth.getUser().hasRight(UserRight.MANAGE_VIDEO_BLOCKS) 28 return this.auth.getUser().hasRight(UserRight.MANAGE_VIDEO_BLACKLIST)
29 } 29 }
30 30
31 hasAccountsBlocklistRight () { 31 hasAccountsBlocklistRight () {
diff --git a/client/src/app/+admin/moderation/moderation.routes.ts b/client/src/app/+admin/moderation/moderation.routes.ts
index aeb555c4a..c08333f17 100644
--- a/client/src/app/+admin/moderation/moderation.routes.ts
+++ b/client/src/app/+admin/moderation/moderation.routes.ts
@@ -57,7 +57,7 @@ export const ModerationRoutes: Routes = [
57 component: VideoBlockListComponent, 57 component: VideoBlockListComponent,
58 canActivate: [ UserRightGuard ], 58 canActivate: [ UserRightGuard ],
59 data: { 59 data: {
60 userRight: UserRight.MANAGE_VIDEO_BLOCKS, 60 userRight: UserRight.MANAGE_VIDEO_BLACKLIST,
61 meta: { 61 meta: {
62 title: 'Videos blocked' 62 title: 'Videos blocked'
63 } 63 }
diff --git a/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts b/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts
index ca37bccf3..a36acc2ab 100644
--- a/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts
+++ b/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts
@@ -107,7 +107,7 @@ export class VideoAbuseListComponent extends RestTable implements OnInit, AfterV
107 this.videoBlocklistService.blockVideo(videoAbuse.video.id, undefined, true) 107 this.videoBlocklistService.blockVideo(videoAbuse.video.id, undefined, true)
108 .subscribe( 108 .subscribe(
109 () => { 109 () => {
110 this.notifier.success(this.i18n('Video blocklisted.')) 110 this.notifier.success(this.i18n('Video blocked.'))
111 111
112 this.updateVideoAbuseState(videoAbuse, VideoAbuseState.ACCEPTED) 112 this.updateVideoAbuseState(videoAbuse, VideoAbuseState.ACCEPTED)
113 }, 113 },
@@ -123,7 +123,7 @@ export class VideoAbuseListComponent extends RestTable implements OnInit, AfterV
123 this.videoBlocklistService.unblockVideo(videoAbuse.video.id) 123 this.videoBlocklistService.unblockVideo(videoAbuse.video.id)
124 .subscribe( 124 .subscribe(
125 () => { 125 () => {
126 this.notifier.success(this.i18n('Video unblocklisted.')) 126 this.notifier.success(this.i18n('Video unblocked.'))
127 127
128 this.updateVideoAbuseState(videoAbuse, VideoAbuseState.ACCEPTED) 128 this.updateVideoAbuseState(videoAbuse, VideoAbuseState.ACCEPTED)
129 }, 129 },
diff --git a/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts b/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts
index e72ab5348..7b3691332 100644
--- a/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts
+++ b/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts
@@ -3,7 +3,7 @@ import { SortMeta } from 'primeng/api'
3import { Notifier, ServerService } from '@app/core' 3import { Notifier, ServerService } from '@app/core'
4import { ConfirmService } from '../../../core' 4import { ConfirmService } from '../../../core'
5import { RestPagination, RestTable, VideoBlockService } from '../../../shared' 5import { RestPagination, RestTable, VideoBlockService } from '../../../shared'
6import { VideoBlocklist, VideoBlockType } from '../../../../../../shared' 6import { VideoBlacklist, VideoBlacklistType } from '../../../../../../shared'
7import { I18n } from '@ngx-translate/i18n-polyfill' 7import { I18n } from '@ngx-translate/i18n-polyfill'
8import { DropdownAction } from '../../../shared/buttons/action-dropdown.component' 8import { DropdownAction } from '../../../shared/buttons/action-dropdown.component'
9import { Video } from '../../../shared/video/video.model' 9import { Video } from '../../../shared/video/video.model'
@@ -18,13 +18,13 @@ import { VideoService } from '@app/shared/video/video.service'
18 styleUrls: [ '../moderation.component.scss', './video-block-list.component.scss' ] 18 styleUrls: [ '../moderation.component.scss', './video-block-list.component.scss' ]
19}) 19})
20export class VideoBlockListComponent extends RestTable implements OnInit { 20export class VideoBlockListComponent extends RestTable implements OnInit {
21 blocklist: (VideoBlocklist & { reasonHtml?: string })[] = [] 21 blocklist: (VideoBlacklist & { reasonHtml?: string })[] = []
22 totalRecords = 0 22 totalRecords = 0
23 sort: SortMeta = { field: 'createdAt', order: -1 } 23 sort: SortMeta = { field: 'createdAt', order: -1 }
24 pagination: RestPagination = { count: this.rowsPerPage, start: 0 } 24 pagination: RestPagination = { count: this.rowsPerPage, start: 0 }
25 listBlockTypeFilter: VideoBlockType = undefined 25 blocklistTypeFilter: VideoBlacklistType = undefined
26 26
27 videoBlocklistActions: DropdownAction<VideoBlocklist>[][] = [] 27 videoBlocklistActions: DropdownAction<VideoBlacklist>[][] = []
28 28
29 constructor ( 29 constructor (
30 private notifier: Notifier, 30 private notifier: Notifier,
@@ -99,7 +99,7 @@ export class VideoBlockListComponent extends RestTable implements OnInit {
99 .subscribe(config => { 99 .subscribe(config => {
100 // don't filter if auto-blacklist is not enabled as this will be the only list 100 // don't filter if auto-blacklist is not enabled as this will be the only list
101 if (config.autoBlacklist.videos.ofUsers.enabled) { 101 if (config.autoBlacklist.videos.ofUsers.enabled) {
102 this.listBlockTypeFilter = VideoBlockType.MANUAL 102 this.blocklistTypeFilter = VideoBlacklistType.MANUAL
103 } 103 }
104 }) 104 })
105 105
@@ -141,7 +141,7 @@ export class VideoBlockListComponent extends RestTable implements OnInit {
141 return 'VideoBlockListComponent' 141 return 'VideoBlockListComponent'
142 } 142 }
143 143
144 getVideoUrl (videoBlock: VideoBlocklist) { 144 getVideoUrl (videoBlock: VideoBlacklist) {
145 return Video.buildClientUrl(videoBlock.video.uuid) 145 return Video.buildClientUrl(videoBlock.video.uuid)
146 } 146 }
147 147
@@ -155,7 +155,7 @@ export class VideoBlockListComponent extends RestTable implements OnInit {
155 return this.markdownRenderer.textMarkdownToHTML(text) 155 return this.markdownRenderer.textMarkdownToHTML(text)
156 } 156 }
157 157
158 async unblockVideo (entry: VideoBlocklist) { 158 async unblockVideo (entry: VideoBlacklist) {
159 const confirmMessage = this.i18n( 159 const confirmMessage = this.i18n(
160 'Do you really want to unblock this video? It will be available again in the videos list.' 160 'Do you really want to unblock this video? It will be available again in the videos list.'
161 ) 161 )
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 a394418cb..b459eb8fa 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
@@ -52,7 +52,7 @@ export class UserCreateComponent extends UserEdit implements OnInit {
52 role: this.userValidatorsService.USER_ROLE, 52 role: this.userValidatorsService.USER_ROLE,
53 videoQuota: this.userValidatorsService.USER_VIDEO_QUOTA, 53 videoQuota: this.userValidatorsService.USER_VIDEO_QUOTA,
54 videoQuotaDaily: this.userValidatorsService.USER_VIDEO_QUOTA_DAILY, 54 videoQuotaDaily: this.userValidatorsService.USER_VIDEO_QUOTA_DAILY,
55 byPassAutoBlacklist: null 55 byPassAutoBlock: null
56 }, defaultValues) 56 }, defaultValues)
57 } 57 }
58 58
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 d30a606d6..0454df7b7 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
@@ -164,7 +164,7 @@
164 164
165 <div class="form-group"> 165 <div class="form-group">
166 <my-peertube-checkbox 166 <my-peertube-checkbox
167 inputName="byPassAutoBlacklist" formControlName="byPassAutoBlacklist" 167 inputName="byPassAutoBlock" formControlName="byPassAutoBlock"
168 i18n-labelText labelText="Doesn't need review before a video goes public" 168 i18n-labelText labelText="Doesn't need review before a video goes public"
169 ></my-peertube-checkbox> 169 ></my-peertube-checkbox>
170 </div> 170 </div>
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 98249bcc1..5f5cc590c 100644
--- a/client/src/app/+admin/users/user-edit/user-edit.ts
+++ b/client/src/app/+admin/users/user-edit/user-edit.ts
@@ -88,7 +88,7 @@ export abstract class UserEdit extends FormReactive implements OnInit {
88 } 88 }
89 89
90 protected buildAdminFlags (formValue: any) { 90 protected buildAdminFlags (formValue: any) {
91 return formValue.byPassAutoBlacklist ? UserAdminFlag.BYPASS_VIDEO_AUTO_BLOCK : UserAdminFlag.NONE 91 return formValue.byPassAutoBlock ? UserAdminFlag.BYPASS_VIDEO_AUTO_BLACKLIST : UserAdminFlag.NONE
92 } 92 }
93 93
94 protected buildQuotaOptions () { 94 protected buildQuotaOptions () {
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 f2bd8c8ec..035c0d4bb 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
@@ -56,7 +56,7 @@ export class UserUpdateComponent extends UserEdit implements OnInit, OnDestroy {
56 role: this.userValidatorsService.USER_ROLE, 56 role: this.userValidatorsService.USER_ROLE,
57 videoQuota: this.userValidatorsService.USER_VIDEO_QUOTA, 57 videoQuota: this.userValidatorsService.USER_VIDEO_QUOTA,
58 videoQuotaDaily: this.userValidatorsService.USER_VIDEO_QUOTA_DAILY, 58 videoQuotaDaily: this.userValidatorsService.USER_VIDEO_QUOTA_DAILY,
59 byPassAutoBlacklist: null 59 byPassAutoBlock: null
60 }, defaultValues) 60 }, defaultValues)
61 61
62 this.paramsSub = this.route.params.subscribe(routeParams => { 62 this.paramsSub = this.route.params.subscribe(routeParams => {
@@ -125,7 +125,7 @@ export class UserUpdateComponent extends UserEdit implements OnInit, OnDestroy {
125 role: userJson.role.toString(), 125 role: userJson.role.toString(),
126 videoQuota: userJson.videoQuota, 126 videoQuota: userJson.videoQuota,
127 videoQuotaDaily: userJson.videoQuotaDaily, 127 videoQuotaDaily: userJson.videoQuotaDaily,
128 byPassAutoBlacklist: userJson.adminFlags & UserAdminFlag.BYPASS_VIDEO_AUTO_BLOCK 128 byPassAutoBlock: userJson.adminFlags & UserAdminFlag.BYPASS_VIDEO_AUTO_BLACKLIST
129 }) 129 })
130 } 130 }
131} 131}
diff --git a/client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.ts b/client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.ts
index 72e26ac28..af17a0352 100644
--- a/client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.ts
+++ b/client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.ts
@@ -49,7 +49,7 @@ export class MyAccountNotificationPreferencesComponent implements OnInit {
49 49
50 this.rightNotifications = { 50 this.rightNotifications = {
51 videoAbuseAsModerator: UserRight.MANAGE_VIDEO_ABUSES, 51 videoAbuseAsModerator: UserRight.MANAGE_VIDEO_ABUSES,
52 videoAutoBlacklistAsModerator: UserRight.MANAGE_VIDEO_BLOCKS, 52 videoAutoBlacklistAsModerator: UserRight.MANAGE_VIDEO_BLACKLIST,
53 newUserRegistration: UserRight.MANAGE_USERS, 53 newUserRegistration: UserRight.MANAGE_USERS,
54 newInstanceFollower: UserRight.MANAGE_SERVER_FOLLOW, 54 newInstanceFollower: UserRight.MANAGE_SERVER_FOLLOW,
55 autoInstanceFollowing: UserRight.MANAGE_CONFIGURATION 55 autoInstanceFollowing: UserRight.MANAGE_CONFIGURATION
diff --git a/client/src/app/menu/menu.component.ts b/client/src/app/menu/menu.component.ts
index 79bf29e9c..ba3342541 100644
--- a/client/src/app/menu/menu.component.ts
+++ b/client/src/app/menu/menu.component.ts
@@ -33,7 +33,7 @@ export class MenuComponent implements OnInit {
33 [UserRight.MANAGE_USERS]: '/admin/users', 33 [UserRight.MANAGE_USERS]: '/admin/users',
34 [UserRight.MANAGE_SERVER_FOLLOW]: '/admin/friends', 34 [UserRight.MANAGE_SERVER_FOLLOW]: '/admin/friends',
35 [UserRight.MANAGE_VIDEO_ABUSES]: '/admin/moderation/video-abuses', 35 [UserRight.MANAGE_VIDEO_ABUSES]: '/admin/moderation/video-abuses',
36 [UserRight.MANAGE_VIDEO_BLOCKS]: '/admin/moderation/video-blocks', 36 [UserRight.MANAGE_VIDEO_BLACKLIST]: '/admin/moderation/video-blocks',
37 [UserRight.MANAGE_JOBS]: '/admin/jobs', 37 [UserRight.MANAGE_JOBS]: '/admin/jobs',
38 [UserRight.MANAGE_CONFIGURATION]: '/admin/config' 38 [UserRight.MANAGE_CONFIGURATION]: '/admin/config'
39 } 39 }
@@ -131,7 +131,7 @@ export class MenuComponent implements OnInit {
131 UserRight.MANAGE_USERS, 131 UserRight.MANAGE_USERS,
132 UserRight.MANAGE_SERVER_FOLLOW, 132 UserRight.MANAGE_SERVER_FOLLOW,
133 UserRight.MANAGE_VIDEO_ABUSES, 133 UserRight.MANAGE_VIDEO_ABUSES,
134 UserRight.MANAGE_VIDEO_BLOCKS, 134 UserRight.MANAGE_VIDEO_BLACKLIST,
135 UserRight.MANAGE_JOBS, 135 UserRight.MANAGE_JOBS,
136 UserRight.MANAGE_CONFIGURATION 136 UserRight.MANAGE_CONFIGURATION
137 ] 137 ]
diff --git a/client/src/app/shared/users/user-notification.model.ts b/client/src/app/shared/users/user-notification.model.ts
index bc1861c64..7b8368d87 100644
--- a/client/src/app/shared/users/user-notification.model.ts
+++ b/client/src/app/shared/users/user-notification.model.ts
@@ -96,7 +96,7 @@ export class UserNotification implements UserNotificationServer {
96 this.videoUrl = this.buildVideoUrl(this.video) 96 this.videoUrl = this.buildVideoUrl(this.video)
97 break 97 break
98 98
99 case UserNotificationType.UNBLOCK_ON_MY_VIDEO: 99 case UserNotificationType.UNBLACKLIST_ON_MY_VIDEO:
100 this.videoUrl = this.buildVideoUrl(this.video) 100 this.videoUrl = this.buildVideoUrl(this.video)
101 break 101 break
102 102
@@ -112,7 +112,7 @@ export class UserNotification implements UserNotificationServer {
112 this.videoUrl = this.buildVideoUrl(this.videoAbuse.video) 112 this.videoUrl = this.buildVideoUrl(this.videoAbuse.video)
113 break 113 break
114 114
115 case UserNotificationType.VIDEO_AUTO_BLOCK_FOR_MODERATORS: 115 case UserNotificationType.VIDEO_AUTO_BLACKLIST_FOR_MODERATORS:
116 this.videoAutoBlacklistUrl = '/admin/moderation/video-auto-blacklist/list' 116 this.videoAutoBlacklistUrl = '/admin/moderation/video-auto-blacklist/list'
117 // Backward compatibility where we did not assign videoBlacklist to this type of notification before 117 // Backward compatibility where we did not assign videoBlacklist to this type of notification before
118 if (!this.videoBlacklist) this.videoBlacklist = { id: null, video: this.video } 118 if (!this.videoBlacklist) this.videoBlacklist = { id: null, video: this.video }
@@ -120,7 +120,7 @@ export class UserNotification implements UserNotificationServer {
120 this.videoUrl = this.buildVideoUrl(this.videoBlacklist.video) 120 this.videoUrl = this.buildVideoUrl(this.videoBlacklist.video)
121 break 121 break
122 122
123 case UserNotificationType.BLOCK_ON_MY_VIDEO: 123 case UserNotificationType.BLACKLIST_ON_MY_VIDEO:
124 this.videoUrl = this.buildVideoUrl(this.videoBlacklist.video) 124 this.videoUrl = this.buildVideoUrl(this.videoBlacklist.video)
125 break 125 break
126 126
diff --git a/client/src/app/shared/users/user-notifications.component.html b/client/src/app/shared/users/user-notifications.component.html
index 5a102995a..c6037f0a9 100644
--- a/client/src/app/shared/users/user-notifications.component.html
+++ b/client/src/app/shared/users/user-notifications.component.html
@@ -26,7 +26,7 @@
26 </ng-template> 26 </ng-template>
27 </ng-container> 27 </ng-container>
28 28
29 <ng-container *ngSwitchCase="UserNotificationType.UNBLOCK_ON_MY_VIDEO"> 29 <ng-container *ngSwitchCase="UserNotificationType.UNBLACKLIST_ON_MY_VIDEO">
30 <my-global-icon iconName="undo"></my-global-icon> 30 <my-global-icon iconName="undo"></my-global-icon>
31 31
32 <div class="message" i18n> 32 <div class="message" i18n>
@@ -34,7 +34,7 @@
34 </div> 34 </div>
35 </ng-container> 35 </ng-container>
36 36
37 <ng-container *ngSwitchCase="UserNotificationType.BLOCK_ON_MY_VIDEO"> 37 <ng-container *ngSwitchCase="UserNotificationType.BLACKLIST_ON_MY_VIDEO">
38 <my-global-icon iconName="no"></my-global-icon> 38 <my-global-icon iconName="no"></my-global-icon>
39 39
40 <div class="message" i18n> 40 <div class="message" i18n>
@@ -50,11 +50,11 @@
50 </div> 50 </div>
51 </ng-container> 51 </ng-container>
52 52
53 <ng-container *ngSwitchCase="UserNotificationType.VIDEO_AUTO_BLOCK_FOR_MODERATORS"> 53 <ng-container *ngSwitchCase="UserNotificationType.VIDEO_AUTO_BLACKLIST_FOR_MODERATORS">
54 <my-global-icon iconName="no"></my-global-icon> 54 <my-global-icon iconName="no"></my-global-icon>
55 55
56 <div class="message" i18n> 56 <div class="message" i18n>
57 The recently added video <a (click)="markAsRead(notification)" [routerLink]="notification.videoUrl">{{ notification.videoBlacklist.video.name }}</a> has been <a (click)="markAsRead(notification)" [routerLink]="notification.videoAutoBlacklistUrl">auto-blocked</a> 57 The recently added video <a (click)="markAsRead(notification)" [routerLink]="notification.videoUrl">{{ notification.videoBlacklist.video.name }}</a> has been <a (click)="markAsRead(notification)" [routerLink]="notification.videoAutoBlacklistUrl">automatically blocked</a>
58 </div> 58 </div>
59 </ng-container> 59 </ng-container>
60 60
diff --git a/client/src/app/shared/video-block/video-block.service.ts b/client/src/app/shared/video-block/video-block.service.ts
index 67ca1d85b..31ccc84ea 100644
--- a/client/src/app/shared/video-block/video-block.service.ts
+++ b/client/src/app/shared/video-block/video-block.service.ts
@@ -3,7 +3,7 @@ import { HttpClient, HttpParams } from '@angular/common/http'
3import { Injectable } from '@angular/core' 3import { Injectable } from '@angular/core'
4import { SortMeta } from 'primeng/api' 4import { SortMeta } from 'primeng/api'
5import { from as observableFrom, Observable } from 'rxjs' 5import { from as observableFrom, Observable } from 'rxjs'
6import { VideoBlocklist, VideoBlockType, ResultList } from '../../../../../shared' 6import { VideoBlacklist, VideoBlacklistType, ResultList } from '../../../../../shared'
7import { environment } from '../../../environments/environment' 7import { environment } from '../../../environments/environment'
8import { RestExtractor, RestPagination, RestService } from '../rest' 8import { RestExtractor, RestPagination, RestService } from '../rest'
9 9
@@ -21,8 +21,8 @@ export class VideoBlockService {
21 pagination: RestPagination 21 pagination: RestPagination
22 sort: SortMeta 22 sort: SortMeta
23 search?: string 23 search?: string
24 type?: VideoBlockType 24 type?: VideoBlacklistType
25 }): Observable<ResultList<VideoBlocklist>> { 25 }): Observable<ResultList<VideoBlacklist>> {
26 const { pagination, sort, search, type } = options 26 const { pagination, sort, search, type } = options
27 27
28 let params = new HttpParams() 28 let params = new HttpParams()
@@ -33,8 +33,8 @@ export class VideoBlockService {
33 type: { 33 type: {
34 prefix: 'type:', 34 prefix: 'type:',
35 handler: v => { 35 handler: v => {
36 if (v === 'manual') return VideoBlockType.MANUAL 36 if (v === 'manual') return VideoBlacklistType.MANUAL
37 if (v === 'auto') return VideoBlockType.AUTO_BEFORE_PUBLISHED 37 if (v === 'auto') return VideoBlacklistType.AUTO_BEFORE_PUBLISHED
38 38
39 return undefined 39 return undefined
40 } 40 }
@@ -44,7 +44,7 @@ export class VideoBlockService {
44 params = this.restService.addObjectParams(params, filters) 44 params = this.restService.addObjectParams(params, filters)
45 } 45 }
46 46
47 return this.authHttp.get<ResultList<VideoBlocklist>>(VideoBlockService.BASE_VIDEOS_URL + 'blacklist', { params }) 47 return this.authHttp.get<ResultList<VideoBlacklist>>(VideoBlockService.BASE_VIDEOS_URL + 'blacklist', { params })
48 .pipe( 48 .pipe(
49 map(res => this.restExtractor.convertResultListDateToHuman(res)), 49 map(res => this.restExtractor.convertResultListDateToHuman(res)),
50 catchError(res => this.restExtractor.handleError(res)) 50 catchError(res => this.restExtractor.handleError(res))
diff --git a/client/src/app/shared/video/video.model.ts b/client/src/app/shared/video/video.model.ts
index 2b3d915ef..16e43cbd8 100644
--- a/client/src/app/shared/video/video.model.ts
+++ b/client/src/app/shared/video/video.model.ts
@@ -164,11 +164,11 @@ export class Video implements VideoServerModel {
164 } 164 }
165 165
166 isBlockableBy (user: AuthUser) { 166 isBlockableBy (user: AuthUser) {
167 return this.blacklisted !== true && user && user.hasRight(UserRight.MANAGE_VIDEO_BLOCKS) === true 167 return this.blacklisted !== true && user && user.hasRight(UserRight.MANAGE_VIDEO_BLACKLIST) === true
168 } 168 }
169 169
170 isUnblockableBy (user: AuthUser) { 170 isUnblockableBy (user: AuthUser) {
171 return this.blacklisted === true && user && user.hasRight(UserRight.MANAGE_VIDEO_BLOCKS) === true 171 return this.blacklisted === true && user && user.hasRight(UserRight.MANAGE_VIDEO_BLACKLIST) === true
172 } 172 }
173 173
174 isUpdatableBy (user: AuthUser) { 174 isUpdatableBy (user: AuthUser) {
diff --git a/client/src/app/videos/+video-watch/video-watch.component.ts b/client/src/app/videos/+video-watch/video-watch.component.ts
index 9f726cf35..df0c1058c 100644
--- a/client/src/app/videos/+video-watch/video-watch.component.ts
+++ b/client/src/app/videos/+video-watch/video-watch.component.ts
@@ -335,7 +335,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
335 this.videoCaptionService.listCaptions(videoId) 335 this.videoCaptionService.listCaptions(videoId)
336 ]) 336 ])
337 .pipe( 337 .pipe(
338 // If 401, the video is private or blocklisted so redirect to 404 338 // If 401, the video is private or blocked so redirect to 404
339 catchError(err => this.restExtractor.redirectTo404IfNotFound(err, [ 400, 401, 403, 404 ])) 339 catchError(err => this.restExtractor.redirectTo404IfNotFound(err, [ 400, 401, 403, 404 ]))
340 ) 340 )
341 .subscribe(([ video, captionsResult ]) => { 341 .subscribe(([ video, captionsResult ]) => {
@@ -364,7 +364,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
364 364
365 this.playlistService.getVideoPlaylist(playlistId) 365 this.playlistService.getVideoPlaylist(playlistId)
366 .pipe( 366 .pipe(
367 // If 401, the video is private or blocklisted so redirect to 404 367 // If 401, the video is private or blocked so redirect to 404
368 catchError(err => this.restExtractor.redirectTo404IfNotFound(err, [ 400, 401, 403, 404 ])) 368 catchError(err => this.restExtractor.redirectTo404IfNotFound(err, [ 400, 401, 403, 404 ]))
369 ) 369 )
370 .subscribe(playlist => { 370 .subscribe(playlist => {
diff --git a/server/controllers/api/videos/blacklist.ts b/server/controllers/api/videos/blacklist.ts
index 2c6948923..3b25ceea2 100644
--- a/server/controllers/api/videos/blacklist.ts
+++ b/server/controllers/api/videos/blacklist.ts
@@ -23,14 +23,14 @@ const blacklistRouter = express.Router()
23 23
24blacklistRouter.post('/:videoId/blacklist', 24blacklistRouter.post('/:videoId/blacklist',
25 authenticate, 25 authenticate,
26 ensureUserHasRight(UserRight.MANAGE_VIDEO_BLOCKS), 26 ensureUserHasRight(UserRight.MANAGE_VIDEO_BLACKLIST),
27 asyncMiddleware(videosBlacklistAddValidator), 27 asyncMiddleware(videosBlacklistAddValidator),
28 asyncMiddleware(addVideoToBlacklistController) 28 asyncMiddleware(addVideoToBlacklistController)
29) 29)
30 30
31blacklistRouter.get('/blacklist', 31blacklistRouter.get('/blacklist',
32 authenticate, 32 authenticate,
33 ensureUserHasRight(UserRight.MANAGE_VIDEO_BLOCKS), 33 ensureUserHasRight(UserRight.MANAGE_VIDEO_BLACKLIST),
34 paginationValidator, 34 paginationValidator,
35 blacklistSortValidator, 35 blacklistSortValidator,
36 setBlacklistSort, 36 setBlacklistSort,
@@ -41,14 +41,14 @@ blacklistRouter.get('/blacklist',
41 41
42blacklistRouter.put('/:videoId/blacklist', 42blacklistRouter.put('/:videoId/blacklist',
43 authenticate, 43 authenticate,
44 ensureUserHasRight(UserRight.MANAGE_VIDEO_BLOCKS), 44 ensureUserHasRight(UserRight.MANAGE_VIDEO_BLACKLIST),
45 asyncMiddleware(videosBlacklistUpdateValidator), 45 asyncMiddleware(videosBlacklistUpdateValidator),
46 asyncMiddleware(updateVideoBlacklistController) 46 asyncMiddleware(updateVideoBlacklistController)
47) 47)
48 48
49blacklistRouter.delete('/:videoId/blacklist', 49blacklistRouter.delete('/:videoId/blacklist',
50 authenticate, 50 authenticate,
51 ensureUserHasRight(UserRight.MANAGE_VIDEO_BLOCKS), 51 ensureUserHasRight(UserRight.MANAGE_VIDEO_BLACKLIST),
52 asyncMiddleware(videosBlacklistRemoveValidator), 52 asyncMiddleware(videosBlacklistRemoveValidator),
53 asyncMiddleware(removeVideoFromBlacklistController) 53 asyncMiddleware(removeVideoFromBlacklistController)
54) 54)
diff --git a/server/helpers/custom-validators/video-blacklist.ts b/server/helpers/custom-validators/video-blacklist.ts
index de6726b8f..17cb3b00b 100644
--- a/server/helpers/custom-validators/video-blacklist.ts
+++ b/server/helpers/custom-validators/video-blacklist.ts
@@ -1,7 +1,7 @@
1import validator from 'validator' 1import validator from 'validator'
2import { exists } from './misc' 2import { exists } from './misc'
3import { CONSTRAINTS_FIELDS } from '../../initializers/constants' 3import { CONSTRAINTS_FIELDS } from '../../initializers/constants'
4import { VideoBlockType } from '../../../shared/models/videos' 4import { VideoBlacklistType } from '../../../shared/models/videos'
5 5
6const VIDEO_BLACKLIST_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEO_BLACKLIST 6const VIDEO_BLACKLIST_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEO_BLACKLIST
7 7
@@ -10,7 +10,7 @@ function isVideoBlacklistReasonValid (value: string) {
10} 10}
11 11
12function isVideoBlacklistTypeValid (value: any) { 12function isVideoBlacklistTypeValid (value: any) {
13 return exists(value) && validator.isInt('' + value) && VideoBlockType[value] !== undefined 13 return exists(value) && validator.isInt('' + value) && VideoBlacklistType[value] !== undefined
14} 14}
15 15
16// --------------------------------------------------------------------------- 16// ---------------------------------------------------------------------------
diff --git a/server/initializers/migrations/0350-video-blacklist-type.ts b/server/initializers/migrations/0350-video-blacklist-type.ts
index 22c82e431..f79ae5ec7 100644
--- a/server/initializers/migrations/0350-video-blacklist-type.ts
+++ b/server/initializers/migrations/0350-video-blacklist-type.ts
@@ -1,5 +1,5 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2import { VideoBlockType } from '../../../shared/models/videos' 2import { VideoBlacklistType } from '../../../shared/models/videos'
3 3
4async function up (utils: { 4async function up (utils: {
5 transaction: Sequelize.Transaction 5 transaction: Sequelize.Transaction
@@ -18,7 +18,7 @@ async function up (utils: {
18 } 18 }
19 19
20 { 20 {
21 const query = 'UPDATE "videoBlacklist" SET "type" = ' + VideoBlockType.MANUAL 21 const query = 'UPDATE "videoBlacklist" SET "type" = ' + VideoBlacklistType.MANUAL
22 await utils.sequelize.query(query) 22 await utils.sequelize.query(query)
23 } 23 }
24 24
diff --git a/server/lib/notifier.ts b/server/lib/notifier.ts
index 3e90bb57e..89f91e031 100644
--- a/server/lib/notifier.ts
+++ b/server/lib/notifier.ts
@@ -387,7 +387,7 @@ class Notifier {
387 } 387 }
388 388
389 private async notifyModeratorsOfVideoAutoBlacklist (videoBlacklist: MVideoBlacklistLightVideo) { 389 private async notifyModeratorsOfVideoAutoBlacklist (videoBlacklist: MVideoBlacklistLightVideo) {
390 const moderators = await UserModel.listWithRight(UserRight.MANAGE_VIDEO_BLOCKS) 390 const moderators = await UserModel.listWithRight(UserRight.MANAGE_VIDEO_BLACKLIST)
391 if (moderators.length === 0) return 391 if (moderators.length === 0) return
392 392
393 logger.info('Notifying %s moderators of video auto-blacklist %s.', moderators.length, videoBlacklist.Video.url) 393 logger.info('Notifying %s moderators of video auto-blacklist %s.', moderators.length, videoBlacklist.Video.url)
@@ -398,7 +398,7 @@ class Notifier {
398 398
399 async function notificationCreator (user: MUserWithNotificationSetting) { 399 async function notificationCreator (user: MUserWithNotificationSetting) {
400 const notification = await UserNotificationModel.create<UserNotificationModelForApi>({ 400 const notification = await UserNotificationModel.create<UserNotificationModelForApi>({
401 type: UserNotificationType.VIDEO_AUTO_BLOCK_FOR_MODERATORS, 401 type: UserNotificationType.VIDEO_AUTO_BLACKLIST_FOR_MODERATORS,
402 userId: user.id, 402 userId: user.id,
403 videoBlacklistId: videoBlacklist.id 403 videoBlacklistId: videoBlacklist.id
404 }) 404 })
@@ -426,7 +426,7 @@ class Notifier {
426 426
427 async function notificationCreator (user: MUserWithNotificationSetting) { 427 async function notificationCreator (user: MUserWithNotificationSetting) {
428 const notification = await UserNotificationModel.create<UserNotificationModelForApi>({ 428 const notification = await UserNotificationModel.create<UserNotificationModelForApi>({
429 type: UserNotificationType.BLOCK_ON_MY_VIDEO, 429 type: UserNotificationType.BLACKLIST_ON_MY_VIDEO,
430 userId: user.id, 430 userId: user.id,
431 videoBlacklistId: videoBlacklist.id 431 videoBlacklistId: videoBlacklist.id
432 }) 432 })
@@ -454,7 +454,7 @@ class Notifier {
454 454
455 async function notificationCreator (user: MUserWithNotificationSetting) { 455 async function notificationCreator (user: MUserWithNotificationSetting) {
456 const notification = await UserNotificationModel.create<UserNotificationModelForApi>({ 456 const notification = await UserNotificationModel.create<UserNotificationModelForApi>({
457 type: UserNotificationType.UNBLOCK_ON_MY_VIDEO, 457 type: UserNotificationType.UNBLACKLIST_ON_MY_VIDEO,
458 userId: user.id, 458 userId: user.id,
459 videoId: video.id 459 videoId: video.id
460 }) 460 })
diff --git a/server/lib/video-blacklist.ts b/server/lib/video-blacklist.ts
index f1657e8f1..1ee92d22c 100644
--- a/server/lib/video-blacklist.ts
+++ b/server/lib/video-blacklist.ts
@@ -8,7 +8,7 @@ import {
8 MVideoFullLight, 8 MVideoFullLight,
9 MVideoWithBlacklistLight 9 MVideoWithBlacklistLight
10} from '@server/typings/models' 10} from '@server/typings/models'
11import { UserRight, VideoBlacklistCreate, VideoBlockType } from '../../shared/models' 11import { UserRight, VideoBlacklistCreate, VideoBlacklistType } from '../../shared/models'
12import { UserAdminFlag } from '../../shared/models/users/user-flag.model' 12import { UserAdminFlag } from '../../shared/models/users/user-flag.model'
13import { logger } from '../helpers/logger' 13import { logger } from '../helpers/logger'
14import { CONFIG } from '../initializers/config' 14import { CONFIG } from '../initializers/config'
@@ -39,7 +39,7 @@ async function autoBlacklistVideoIfNeeded (parameters: {
39 videoId: video.id, 39 videoId: video.id,
40 unfederated: true, 40 unfederated: true,
41 reason: 'Auto-blacklisted. Moderator review required.', 41 reason: 'Auto-blacklisted. Moderator review required.',
42 type: VideoBlockType.AUTO_BEFORE_PUBLISHED 42 type: VideoBlacklistType.AUTO_BEFORE_PUBLISHED
43 } 43 }
44 const [ videoBlacklist ] = await VideoBlacklistModel.findOrCreate<MVideoBlacklistVideo>({ 44 const [ videoBlacklist ] = await VideoBlacklistModel.findOrCreate<MVideoBlacklistVideo>({
45 where: { 45 where: {
@@ -64,7 +64,7 @@ async function blacklistVideo (videoInstance: MVideoAccountLight, options: Video
64 videoId: videoInstance.id, 64 videoId: videoInstance.id,
65 unfederated: options.unfederate === true, 65 unfederated: options.unfederate === true,
66 reason: options.reason, 66 reason: options.reason,
67 type: VideoBlockType.MANUAL 67 type: VideoBlacklistType.MANUAL
68 } 68 }
69 ) 69 )
70 blacklist.Video = videoInstance 70 blacklist.Video = videoInstance
@@ -94,7 +94,7 @@ async function unblacklistVideo (videoBlacklist: MVideoBlacklist, video: MVideoF
94 94
95 Notifier.Instance.notifyOnVideoUnblacklist(video) 95 Notifier.Instance.notifyOnVideoUnblacklist(video)
96 96
97 if (videoBlacklistType === VideoBlockType.AUTO_BEFORE_PUBLISHED) { 97 if (videoBlacklistType === VideoBlacklistType.AUTO_BEFORE_PUBLISHED) {
98 Notifier.Instance.notifyOnVideoPublishedAfterRemovedFromAutoBlacklist(video) 98 Notifier.Instance.notifyOnVideoPublishedAfterRemovedFromAutoBlacklist(video)
99 99
100 // Delete on object so new video notifications will send 100 // Delete on object so new video notifications will send
@@ -126,7 +126,7 @@ function autoBlacklistNeeded (parameters: {
126 if (!CONFIG.AUTO_BLACKLIST.VIDEOS.OF_USERS.ENABLED || !user) return false 126 if (!CONFIG.AUTO_BLACKLIST.VIDEOS.OF_USERS.ENABLED || !user) return false
127 if (isRemote || isNew === false) return false 127 if (isRemote || isNew === false) return false
128 128
129 if (user.hasRight(UserRight.MANAGE_VIDEO_BLOCKS) || user.hasAdminFlag(UserAdminFlag.BYPASS_VIDEO_AUTO_BLOCK)) return false 129 if (user.hasRight(UserRight.MANAGE_VIDEO_BLACKLIST) || user.hasAdminFlag(UserAdminFlag.BYPASS_VIDEO_AUTO_BLACKLIST)) return false
130 130
131 return true 131 return true
132} 132}
diff --git a/server/models/account/user.ts b/server/models/account/user.ts
index 4ea175583..fbd3080c6 100644
--- a/server/models/account/user.ts
+++ b/server/models/account/user.ts
@@ -739,11 +739,11 @@ export class UserModel extends Model<UserModel> {
739 const videoUserId = video.VideoChannel.Account.userId 739 const videoUserId = video.VideoChannel.Account.userId
740 740
741 if (video.isBlacklisted()) { 741 if (video.isBlacklisted()) {
742 return videoUserId === this.id || this.hasRight(UserRight.MANAGE_VIDEO_BLOCKS) 742 return videoUserId === this.id || this.hasRight(UserRight.MANAGE_VIDEO_BLACKLIST)
743 } 743 }
744 744
745 if (video.privacy === VideoPrivacy.PRIVATE) { 745 if (video.privacy === VideoPrivacy.PRIVATE) {
746 return video.VideoChannel && videoUserId === this.id || this.hasRight(UserRight.MANAGE_VIDEO_BLOCKS) 746 return video.VideoChannel && videoUserId === this.id || this.hasRight(UserRight.MANAGE_VIDEO_BLACKLIST)
747 } 747 }
748 748
749 if (video.privacy === VideoPrivacy.INTERNAL) return true 749 if (video.privacy === VideoPrivacy.INTERNAL) return true
diff --git a/server/models/video/video-blacklist.ts b/server/models/video/video-blacklist.ts
index 70a6ecb03..8cbfe362e 100644
--- a/server/models/video/video-blacklist.ts
+++ b/server/models/video/video-blacklist.ts
@@ -3,7 +3,7 @@ import { getBlacklistSort, SortType, throwIfNotValid, searchAttribute } from '..
3import { VideoModel } from './video' 3import { VideoModel } from './video'
4import { ScopeNames as VideoChannelScopeNames, SummaryOptions, VideoChannelModel } from './video-channel' 4import { ScopeNames as VideoChannelScopeNames, SummaryOptions, VideoChannelModel } from './video-channel'
5import { isVideoBlacklistReasonValid, isVideoBlacklistTypeValid } from '../../helpers/custom-validators/video-blacklist' 5import { isVideoBlacklistReasonValid, isVideoBlacklistTypeValid } from '../../helpers/custom-validators/video-blacklist'
6import { VideoBlocklist, VideoBlockType } from '../../../shared/models/videos' 6import { VideoBlacklist, VideoBlacklistType } from '../../../shared/models/videos'
7import { CONSTRAINTS_FIELDS } from '../../initializers/constants' 7import { CONSTRAINTS_FIELDS } from '../../initializers/constants'
8import { FindOptions } from 'sequelize' 8import { FindOptions } from 'sequelize'
9import { ThumbnailModel } from './thumbnail' 9import { ThumbnailModel } from './thumbnail'
@@ -34,7 +34,7 @@ export class VideoBlacklistModel extends Model<VideoBlacklistModel> {
34 @Default(null) 34 @Default(null)
35 @Is('VideoBlacklistType', value => throwIfNotValid(value, isVideoBlacklistTypeValid, 'type')) 35 @Is('VideoBlacklistType', value => throwIfNotValid(value, isVideoBlacklistTypeValid, 'type'))
36 @Column 36 @Column
37 type: VideoBlockType 37 type: VideoBlacklistType
38 38
39 @CreatedAt 39 @CreatedAt
40 createdAt: Date 40 createdAt: Date
@@ -59,7 +59,7 @@ export class VideoBlacklistModel extends Model<VideoBlacklistModel> {
59 count: number 59 count: number
60 sort: SortType 60 sort: SortType
61 search?: string 61 search?: string
62 type?: VideoBlockType 62 type?: VideoBlacklistType
63 }) { 63 }) {
64 const { start, count, sort, search, type } = parameters 64 const { start, count, sort, search, type } = parameters
65 65
@@ -119,7 +119,7 @@ export class VideoBlacklistModel extends Model<VideoBlacklistModel> {
119 return VideoBlacklistModel.findOne(query) 119 return VideoBlacklistModel.findOne(query)
120 } 120 }
121 121
122 toFormattedJSON (this: MVideoBlacklistFormattable): VideoBlocklist { 122 toFormattedJSON (this: MVideoBlacklistFormattable): VideoBlacklist {
123 return { 123 return {
124 id: this.id, 124 id: this.id,
125 createdAt: this.createdAt, 125 createdAt: this.createdAt,
diff --git a/server/tests/api/check-params/users.ts b/server/tests/api/check-params/users.ts
index 94d47408a..472fbda43 100644
--- a/server/tests/api/check-params/users.ts
+++ b/server/tests/api/check-params/users.ts
@@ -188,7 +188,7 @@ describe('Test users API validators', function () {
188 videoQuota: -1, 188 videoQuota: -1,
189 videoQuotaDaily: -1, 189 videoQuotaDaily: -1,
190 role: UserRole.USER, 190 role: UserRole.USER,
191 adminFlags: UserAdminFlag.BYPASS_VIDEO_AUTO_BLOCK 191 adminFlags: UserAdminFlag.BYPASS_VIDEO_AUTO_BLACKLIST
192 } 192 }
193 193
194 it('Should fail with a too small username', async function () { 194 it('Should fail with a too small username', async function () {
diff --git a/server/tests/api/check-params/video-blacklist.ts b/server/tests/api/check-params/video-blacklist.ts
index b96c26989..145f43980 100644
--- a/server/tests/api/check-params/video-blacklist.ts
+++ b/server/tests/api/check-params/video-blacklist.ts
@@ -24,7 +24,7 @@ import {
24 checkBadSortPagination, 24 checkBadSortPagination,
25 checkBadStartPagination 25 checkBadStartPagination
26} from '../../../../shared/extra-utils/requests/check-api-params' 26} from '../../../../shared/extra-utils/requests/check-api-params'
27import { VideoBlockType, VideoDetails } from '../../../../shared/models/videos' 27import { VideoBlacklistType, VideoDetails } from '../../../../shared/models/videos'
28import { expect } from 'chai' 28import { expect } from 'chai'
29 29
30describe('Test video blacklist API validators', function () { 30describe('Test video blacklist API validators', function () {
@@ -243,7 +243,7 @@ describe('Test video blacklist API validators', function () {
243 }) 243 })
244 244
245 it('Should succeed with the correct parameters', async function () { 245 it('Should succeed with the correct parameters', async function () {
246 await getBlacklistedVideosList({ url: servers[0].url, token: servers[0].accessToken, type: VideoBlockType.MANUAL }) 246 await getBlacklistedVideosList({ url: servers[0].url, token: servers[0].accessToken, type: VideoBlacklistType.MANUAL })
247 }) 247 })
248 }) 248 })
249 249
diff --git a/server/tests/api/users/users.ts b/server/tests/api/users/users.ts
index af5a5fd25..cad954fcb 100644
--- a/server/tests/api/users/users.ts
+++ b/server/tests/api/users/users.ts
@@ -265,7 +265,7 @@ describe('Test users', function () {
265 username: user.username, 265 username: user.username,
266 password: user.password, 266 password: user.password,
267 videoQuota: 2 * 1024 * 1024, 267 videoQuota: 2 * 1024 * 1024,
268 adminFlags: UserAdminFlag.BYPASS_VIDEO_AUTO_BLOCK 268 adminFlags: UserAdminFlag.BYPASS_VIDEO_AUTO_BLACKLIST
269 }) 269 })
270 }) 270 })
271 271
@@ -292,7 +292,7 @@ describe('Test users', function () {
292 } 292 }
293 293
294 expect(userMe.adminFlags).to.be.undefined 294 expect(userMe.adminFlags).to.be.undefined
295 expect(userGet.adminFlags).to.equal(UserAdminFlag.BYPASS_VIDEO_AUTO_BLOCK) 295 expect(userGet.adminFlags).to.equal(UserAdminFlag.BYPASS_VIDEO_AUTO_BLACKLIST)
296 296
297 expect(userMe.specialPlaylists).to.have.lengthOf(1) 297 expect(userMe.specialPlaylists).to.have.lengthOf(1)
298 expect(userMe.specialPlaylists[0].type).to.equal(VideoPlaylistType.WATCH_LATER) 298 expect(userMe.specialPlaylists[0].type).to.equal(VideoPlaylistType.WATCH_LATER)
diff --git a/server/tests/api/videos/video-blacklist.ts b/server/tests/api/videos/video-blacklist.ts
index 6e15893f3..a8500627b 100644
--- a/server/tests/api/videos/video-blacklist.ts
+++ b/server/tests/api/videos/video-blacklist.ts
@@ -25,7 +25,7 @@ import {
25} from '../../../../shared/extra-utils/index' 25} from '../../../../shared/extra-utils/index'
26import { doubleFollow } from '../../../../shared/extra-utils/server/follows' 26import { doubleFollow } from '../../../../shared/extra-utils/server/follows'
27import { waitJobs } from '../../../../shared/extra-utils/server/jobs' 27import { waitJobs } from '../../../../shared/extra-utils/server/jobs'
28import { VideoBlocklist, VideoBlockType } from '../../../../shared/models/videos' 28import { VideoBlacklist, VideoBlacklistType } from '../../../../shared/models/videos'
29import { UserAdminFlag } from '../../../../shared/models/users/user-flag.model' 29import { UserAdminFlag } from '../../../../shared/models/users/user-flag.model'
30import { User, UserRole } from '../../../../shared/models/users' 30import { User, UserRole } from '../../../../shared/models/users'
31import { getMagnetURI, getYoutubeVideoUrl, importVideo } from '../../../../shared/extra-utils/videos/video-imports' 31import { getMagnetURI, getYoutubeVideoUrl, importVideo } from '../../../../shared/extra-utils/videos/video-imports'
@@ -127,7 +127,7 @@ describe('Test video blacklist', function () {
127 const res = await getBlacklistedVideosList({ 127 const res = await getBlacklistedVideosList({
128 url: servers[0].url, 128 url: servers[0].url,
129 token: servers[0].accessToken, 129 token: servers[0].accessToken,
130 type: VideoBlockType.MANUAL 130 type: VideoBlacklistType.MANUAL
131 }) 131 })
132 132
133 expect(res.body.total).to.equal(2) 133 expect(res.body.total).to.equal(2)
@@ -141,7 +141,7 @@ describe('Test video blacklist', function () {
141 const res = await getBlacklistedVideosList({ 141 const res = await getBlacklistedVideosList({
142 url: servers[0].url, 142 url: servers[0].url,
143 token: servers[0].accessToken, 143 token: servers[0].accessToken,
144 type: VideoBlockType.AUTO_BEFORE_PUBLISHED 144 type: VideoBlacklistType.AUTO_BEFORE_PUBLISHED
145 }) 145 })
146 146
147 expect(res.body.total).to.equal(0) 147 expect(res.body.total).to.equal(0)
@@ -219,7 +219,7 @@ describe('Test video blacklist', function () {
219 }) 219 })
220 220
221 describe('When removing a blacklisted video', function () { 221 describe('When removing a blacklisted video', function () {
222 let videoToRemove: VideoBlocklist 222 let videoToRemove: VideoBlacklist
223 let blacklist = [] 223 let blacklist = []
224 224
225 it('Should not have any video in videos list on server 1', async function () { 225 it('Should not have any video in videos list on server 1', async function () {
@@ -328,7 +328,7 @@ describe('Test video blacklist', function () {
328 it('Should have the correct video blacklist unfederate attribute', async function () { 328 it('Should have the correct video blacklist unfederate attribute', async function () {
329 const res = await getBlacklistedVideosList({ url: servers[0].url, token: servers[0].accessToken, sort: 'createdAt' }) 329 const res = await getBlacklistedVideosList({ url: servers[0].url, token: servers[0].accessToken, sort: 'createdAt' })
330 330
331 const blacklistedVideos: VideoBlocklist[] = res.body.data 331 const blacklistedVideos: VideoBlacklist[] = res.body.data
332 const video3Blacklisted = blacklistedVideos.find(b => b.video.uuid === video3UUID) 332 const video3Blacklisted = blacklistedVideos.find(b => b.video.uuid === video3UUID)
333 const video4Blacklisted = blacklistedVideos.find(b => b.video.uuid === video4UUID) 333 const video4Blacklisted = blacklistedVideos.find(b => b.video.uuid === video4UUID)
334 334
@@ -396,7 +396,7 @@ describe('Test video blacklist', function () {
396 url: servers[0].url, 396 url: servers[0].url,
397 accessToken: servers[0].accessToken, 397 accessToken: servers[0].accessToken,
398 username: user.username, 398 username: user.username,
399 adminFlags: UserAdminFlag.BYPASS_VIDEO_AUTO_BLOCK, 399 adminFlags: UserAdminFlag.BYPASS_VIDEO_AUTO_BLACKLIST,
400 password: user.password, 400 password: user.password,
401 role: UserRole.USER 401 role: UserRole.USER
402 }) 402 })
@@ -413,7 +413,7 @@ describe('Test video blacklist', function () {
413 const res = await getBlacklistedVideosList({ 413 const res = await getBlacklistedVideosList({
414 url: servers[0].url, 414 url: servers[0].url,
415 token: servers[0].accessToken, 415 token: servers[0].accessToken,
416 type: VideoBlockType.AUTO_BEFORE_PUBLISHED 416 type: VideoBlacklistType.AUTO_BEFORE_PUBLISHED
417 }) 417 })
418 418
419 expect(res.body.total).to.equal(1) 419 expect(res.body.total).to.equal(1)
@@ -434,7 +434,7 @@ describe('Test video blacklist', function () {
434 url: servers[0].url, 434 url: servers[0].url,
435 token: servers[0].accessToken, 435 token: servers[0].accessToken,
436 sort: 'createdAt', 436 sort: 'createdAt',
437 type: VideoBlockType.AUTO_BEFORE_PUBLISHED 437 type: VideoBlacklistType.AUTO_BEFORE_PUBLISHED
438 }) 438 })
439 439
440 expect(res.body.total).to.equal(2) 440 expect(res.body.total).to.equal(2)
@@ -453,7 +453,7 @@ describe('Test video blacklist', function () {
453 url: servers[0].url, 453 url: servers[0].url,
454 token: servers[0].accessToken, 454 token: servers[0].accessToken,
455 sort: 'createdAt', 455 sort: 'createdAt',
456 type: VideoBlockType.AUTO_BEFORE_PUBLISHED 456 type: VideoBlacklistType.AUTO_BEFORE_PUBLISHED
457 }) 457 })
458 458
459 expect(res.body.total).to.equal(3) 459 expect(res.body.total).to.equal(3)
@@ -466,7 +466,7 @@ describe('Test video blacklist', function () {
466 const res = await getBlacklistedVideosList({ 466 const res = await getBlacklistedVideosList({
467 url: servers[0].url, 467 url: servers[0].url,
468 token: servers[0].accessToken, 468 token: servers[0].accessToken,
469 type: VideoBlockType.AUTO_BEFORE_PUBLISHED 469 type: VideoBlacklistType.AUTO_BEFORE_PUBLISHED
470 }) 470 })
471 471
472 expect(res.body.total).to.equal(3) 472 expect(res.body.total).to.equal(3)
diff --git a/shared/extra-utils/users/user-notifications.ts b/shared/extra-utils/users/user-notifications.ts
index 6f85bd450..bd00894c4 100644
--- a/shared/extra-utils/users/user-notifications.ts
+++ b/shared/extra-utils/users/user-notifications.ts
@@ -455,7 +455,7 @@ async function checkNewVideoAbuseForModerators (base: CheckerBaseParams, videoUU
455} 455}
456 456
457async function checkVideoAutoBlacklistForModerators (base: CheckerBaseParams, videoUUID: string, videoName: string, type: CheckerType) { 457async function checkVideoAutoBlacklistForModerators (base: CheckerBaseParams, videoUUID: string, videoName: string, type: CheckerType) {
458 const notificationType = UserNotificationType.VIDEO_AUTO_BLOCK_FOR_MODERATORS 458 const notificationType = UserNotificationType.VIDEO_AUTO_BLACKLIST_FOR_MODERATORS
459 459
460 function notificationChecker (notification: UserNotification, type: CheckerType) { 460 function notificationChecker (notification: UserNotification, type: CheckerType) {
461 if (type === 'presence') { 461 if (type === 'presence') {
@@ -486,8 +486,8 @@ async function checkNewBlacklistOnMyVideo (
486 blacklistType: 'blacklist' | 'unblacklist' 486 blacklistType: 'blacklist' | 'unblacklist'
487) { 487) {
488 const notificationType = blacklistType === 'blacklist' 488 const notificationType = blacklistType === 'blacklist'
489 ? UserNotificationType.BLOCK_ON_MY_VIDEO 489 ? UserNotificationType.BLACKLIST_ON_MY_VIDEO
490 : UserNotificationType.UNBLOCK_ON_MY_VIDEO 490 : UserNotificationType.UNBLACKLIST_ON_MY_VIDEO
491 491
492 function notificationChecker (notification: UserNotification) { 492 function notificationChecker (notification: UserNotification) {
493 expect(notification).to.not.be.undefined 493 expect(notification).to.not.be.undefined
diff --git a/shared/extra-utils/videos/video-blacklist.ts b/shared/extra-utils/videos/video-blacklist.ts
index c06b2aa5d..ba139ef95 100644
--- a/shared/extra-utils/videos/video-blacklist.ts
+++ b/shared/extra-utils/videos/video-blacklist.ts
@@ -1,5 +1,5 @@
1import * as request from 'supertest' 1import * as request from 'supertest'
2import { VideoBlockType } from '../../models/videos' 2import { VideoBlacklistType } from '../../models/videos'
3import { makeGetRequest } from '..' 3import { makeGetRequest } from '..'
4 4
5function addVideoToBlacklist ( 5function addVideoToBlacklist (
@@ -45,7 +45,7 @@ function getBlacklistedVideosList (parameters: {
45 url: string 45 url: string
46 token: string 46 token: string
47 sort?: string 47 sort?: string
48 type?: VideoBlockType 48 type?: VideoBlacklistType
49 specialStatus?: number 49 specialStatus?: number
50}) { 50}) {
51 const { url, token, sort, type, specialStatus = 200 } = parameters 51 const { url, token, sort, type, specialStatus = 200 } = parameters
diff --git a/shared/models/users/user-flag.model.ts b/shared/models/users/user-flag.model.ts
index e8b5a5c50..b94262d5e 100644
--- a/shared/models/users/user-flag.model.ts
+++ b/shared/models/users/user-flag.model.ts
@@ -1,4 +1,4 @@
1export enum UserAdminFlag { 1export enum UserAdminFlag {
2 NONE = 0, 2 NONE = 0,
3 BYPASS_VIDEO_AUTO_BLOCK = 1 << 0 3 BYPASS_VIDEO_AUTO_BLACKLIST = 1 << 0
4} 4}
diff --git a/shared/models/users/user-notification.model.ts b/shared/models/users/user-notification.model.ts
index 2329503a8..e9be1ca7f 100644
--- a/shared/models/users/user-notification.model.ts
+++ b/shared/models/users/user-notification.model.ts
@@ -5,8 +5,8 @@ export enum UserNotificationType {
5 NEW_COMMENT_ON_MY_VIDEO = 2, 5 NEW_COMMENT_ON_MY_VIDEO = 2,
6 NEW_VIDEO_ABUSE_FOR_MODERATORS = 3, 6 NEW_VIDEO_ABUSE_FOR_MODERATORS = 3,
7 7
8 BLOCK_ON_MY_VIDEO = 4, 8 BLACKLIST_ON_MY_VIDEO = 4,
9 UNBLOCK_ON_MY_VIDEO = 5, 9 UNBLACKLIST_ON_MY_VIDEO = 5,
10 10
11 MY_VIDEO_PUBLISHED = 6, 11 MY_VIDEO_PUBLISHED = 6,
12 12
@@ -17,7 +17,7 @@ export enum UserNotificationType {
17 NEW_FOLLOW = 10, 17 NEW_FOLLOW = 10,
18 COMMENT_MENTION = 11, 18 COMMENT_MENTION = 11,
19 19
20 VIDEO_AUTO_BLOCK_FOR_MODERATORS = 12, 20 VIDEO_AUTO_BLACKLIST_FOR_MODERATORS = 12,
21 21
22 NEW_INSTANCE_FOLLOWER = 13, 22 NEW_INSTANCE_FOLLOWER = 13,
23 23
diff --git a/shared/models/users/user-right.enum.ts b/shared/models/users/user-right.enum.ts
index 3fb760709..2f88a65de 100644
--- a/shared/models/users/user-right.enum.ts
+++ b/shared/models/users/user-right.enum.ts
@@ -20,7 +20,7 @@ export enum UserRight {
20 MANAGE_ACCOUNTS_BLOCKLIST, 20 MANAGE_ACCOUNTS_BLOCKLIST,
21 MANAGE_SERVERS_BLOCKLIST, 21 MANAGE_SERVERS_BLOCKLIST,
22 22
23 MANAGE_VIDEO_BLOCKS, 23 MANAGE_VIDEO_BLACKLIST,
24 24
25 REMOVE_ANY_VIDEO, 25 REMOVE_ANY_VIDEO,
26 REMOVE_ANY_VIDEO_CHANNEL, 26 REMOVE_ANY_VIDEO_CHANNEL,
diff --git a/shared/models/users/user-role.ts b/shared/models/users/user-role.ts
index 30ec5edce..2b08b5850 100644
--- a/shared/models/users/user-role.ts
+++ b/shared/models/users/user-role.ts
@@ -19,7 +19,7 @@ const userRoleRights: { [ id in UserRole ]: UserRight[] } = {
19 ], 19 ],
20 20
21 [UserRole.MODERATOR]: [ 21 [UserRole.MODERATOR]: [
22 UserRight.MANAGE_VIDEO_BLOCKS, 22 UserRight.MANAGE_VIDEO_BLACKLIST,
23 UserRight.MANAGE_VIDEO_ABUSES, 23 UserRight.MANAGE_VIDEO_ABUSES,
24 UserRight.REMOVE_ANY_VIDEO, 24 UserRight.REMOVE_ANY_VIDEO,
25 UserRight.REMOVE_ANY_VIDEO_CHANNEL, 25 UserRight.REMOVE_ANY_VIDEO_CHANNEL,
diff --git a/shared/models/videos/blacklist/video-blacklist.model.ts b/shared/models/videos/blacklist/video-blacklist.model.ts
index e6090b1e9..a6e0ef175 100644
--- a/shared/models/videos/blacklist/video-blacklist.model.ts
+++ b/shared/models/videos/blacklist/video-blacklist.model.ts
@@ -1,15 +1,15 @@
1import { Video } from '../video.model' 1import { Video } from '../video.model'
2 2
3export enum VideoBlockType { 3export enum VideoBlacklistType {
4 MANUAL = 1, 4 MANUAL = 1,
5 AUTO_BEFORE_PUBLISHED = 2 5 AUTO_BEFORE_PUBLISHED = 2
6} 6}
7 7
8export interface VideoBlocklist { 8export interface VideoBlacklist {
9 id: number 9 id: number
10 unfederated: boolean 10 unfederated: boolean
11 reason?: string 11 reason?: string
12 type: VideoBlockType 12 type: VideoBlacklistType
13 13
14 video: Video 14 video: Video
15 15