diff options
Diffstat (limited to 'server/lib/video-blacklist.ts')
-rw-r--r-- | server/lib/video-blacklist.ts | 6 |
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 @@ | |||
1 | import * as sequelize from 'sequelize' | 1 | import * as sequelize from 'sequelize' |
2 | import { CONFIG } from '../initializers/config' | 2 | import { CONFIG } from '../initializers/config' |
3 | import { VideoBlacklistType, UserRight } from '../../shared/models' | 3 | import { UserRight, VideoBlacklistType } from '../../shared/models' |
4 | import { VideoBlacklistModel } from '../models/video/video-blacklist' | 4 | import { VideoBlacklistModel } from '../models/video/video-blacklist' |
5 | import { UserModel } from '../models/account/user' | 5 | import { UserModel } from '../models/account/user' |
6 | import { VideoModel } from '../models/video/video' | 6 | import { VideoModel } from '../models/video/video' |
7 | import { logger } from '../helpers/logger' | 7 | import { logger } from '../helpers/logger' |
8 | import { UserAdminFlag } from '../../shared/models/users/user-flag.model' | ||
8 | 9 | ||
9 | async function autoBlacklistVideoIfNeeded (video: VideoModel, user: UserModel, transaction: sequelize.Transaction) { | 10 | async 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 |