aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/video-blacklist.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-04-15 10:49:46 +0200
committerChocobozzz <me@florianbigard.com>2019-04-15 14:39:52 +0200
commit1eddc9a74f9a80fa5d0cb25fceb3fc47a1a3c14a (patch)
tree91a10310cdf924779527525d39f8eb7e09e4ba49 /server/lib/video-blacklist.ts
parent31b48aad478506d4214586f02792816efa968e4b (diff)
downloadPeerTube-1eddc9a74f9a80fa5d0cb25fceb3fc47a1a3c14a.tar.gz
PeerTube-1eddc9a74f9a80fa5d0cb25fceb3fc47a1a3c14a.tar.zst
PeerTube-1eddc9a74f9a80fa5d0cb25fceb3fc47a1a3c14a.zip
Add user adminFlags
Diffstat (limited to 'server/lib/video-blacklist.ts')
-rw-r--r--server/lib/video-blacklist.ts6
1 files changed, 4 insertions, 2 deletions
diff --git a/server/lib/video-blacklist.ts b/server/lib/video-blacklist.ts
index a5c6fcbb2..985b89e31 100644
--- a/server/lib/video-blacklist.ts
+++ b/server/lib/video-blacklist.ts
@@ -1,15 +1,16 @@
1import * as sequelize from 'sequelize' 1import * as sequelize from 'sequelize'
2import { CONFIG } from '../initializers/config' 2import { CONFIG } from '../initializers/config'
3import { VideoBlacklistType, UserRight } from '../../shared/models' 3import { UserRight, VideoBlacklistType } from '../../shared/models'
4import { VideoBlacklistModel } from '../models/video/video-blacklist' 4import { VideoBlacklistModel } from '../models/video/video-blacklist'
5import { UserModel } from '../models/account/user' 5import { UserModel } from '../models/account/user'
6import { VideoModel } from '../models/video/video' 6import { VideoModel } from '../models/video/video'
7import { logger } from '../helpers/logger' 7import { logger } from '../helpers/logger'
8import { UserAdminFlag } from '../../shared/models/users/user-flag.model'
8 9
9async function autoBlacklistVideoIfNeeded (video: VideoModel, user: UserModel, transaction: sequelize.Transaction) { 10async function autoBlacklistVideoIfNeeded (video: VideoModel, user: UserModel, transaction: sequelize.Transaction) {
10 if (!CONFIG.AUTO_BLACKLIST.VIDEOS.OF_USERS.ENABLED) return false 11 if (!CONFIG.AUTO_BLACKLIST.VIDEOS.OF_USERS.ENABLED) return false
11 12
12 if (user.hasRight(UserRight.MANAGE_VIDEO_BLACKLIST)) return false 13 if (user.hasRight(UserRight.MANAGE_VIDEO_BLACKLIST) || user.hasAdminFlag(UserAdminFlag.BY_PASS_VIDEO_AUTO_BLACKLIST)) return false
13 14
14 const sequelizeOptions = { transaction } 15 const sequelizeOptions = { transaction }
15 const videoBlacklistToCreate = { 16 const videoBlacklistToCreate = {
@@ -19,6 +20,7 @@ async function autoBlacklistVideoIfNeeded (video: VideoModel, user: UserModel, t
19 type: VideoBlacklistType.AUTO_BEFORE_PUBLISHED 20 type: VideoBlacklistType.AUTO_BEFORE_PUBLISHED
20 } 21 }
21 await VideoBlacklistModel.create(videoBlacklistToCreate, sequelizeOptions) 22 await VideoBlacklistModel.create(videoBlacklistToCreate, sequelizeOptions)
23
22 logger.info('Video %s auto-blacklisted.', video.uuid) 24 logger.info('Video %s auto-blacklisted.', video.uuid)
23 25
24 return true 26 return true