aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2020-06-09 16:07:10 +0200
committerRigel Kent <sendmemail@rigelk.eu>2020-06-10 21:12:09 +0200
commit3487330d308166afb542cbacae0475693c0b059e (patch)
tree6a7b6ea3dd105661354bf0df6c6d3f7a7abe64e8 /server
parent5baee5fca418487e72ddcd6419d31bca8659b668 (diff)
downloadPeerTube-3487330d308166afb542cbacae0475693c0b059e.tar.gz
PeerTube-3487330d308166afb542cbacae0475693c0b059e.tar.zst
PeerTube-3487330d308166afb542cbacae0475693c0b059e.zip
preserve original variable names server-side
Diffstat (limited to 'server')
-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
11 files changed, 38 insertions, 38 deletions
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)