diff options
author | Chocobozzz <me@florianbigard.com> | 2019-04-15 10:49:46 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-04-15 14:39:52 +0200 |
commit | 1eddc9a74f9a80fa5d0cb25fceb3fc47a1a3c14a (patch) | |
tree | 91a10310cdf924779527525d39f8eb7e09e4ba49 /server/lib/video-blacklist.ts | |
parent | 31b48aad478506d4214586f02792816efa968e4b (diff) | |
download | PeerTube-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.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 |