diff options
Diffstat (limited to 'server/lib/video-blacklist.ts')
-rw-r--r-- | server/lib/video-blacklist.ts | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/server/lib/video-blacklist.ts b/server/lib/video-blacklist.ts index 1dd7139f7..bdaecd8e2 100644 --- a/server/lib/video-blacklist.ts +++ b/server/lib/video-blacklist.ts | |||
@@ -7,15 +7,17 @@ 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 | import { UserAdminFlag } from '../../shared/models/users/user-flag.model' |
9 | import { Hooks } from './plugins/hooks' | 9 | import { Hooks } from './plugins/hooks' |
10 | import { Notifier } from './notifier' | ||
10 | 11 | ||
11 | async function autoBlacklistVideoIfNeeded (parameters: { | 12 | async function autoBlacklistVideoIfNeeded (parameters: { |
12 | video: VideoModel, | 13 | video: VideoModel, |
13 | user?: UserModel, | 14 | user?: UserModel, |
14 | isRemote: boolean, | 15 | isRemote: boolean, |
15 | isNew: boolean, | 16 | isNew: boolean, |
17 | notify?: boolean, | ||
16 | transaction?: Transaction | 18 | transaction?: Transaction |
17 | }) { | 19 | }) { |
18 | const { video, user, isRemote, isNew, transaction } = parameters | 20 | const { video, user, isRemote, isNew, notify = true, transaction } = parameters |
19 | const doAutoBlacklist = await Hooks.wrapPromiseFun( | 21 | const doAutoBlacklist = await Hooks.wrapPromiseFun( |
20 | autoBlacklistNeeded, | 22 | autoBlacklistNeeded, |
21 | { video, user, isRemote, isNew }, | 23 | { video, user, isRemote, isNew }, |
@@ -37,9 +39,10 @@ async function autoBlacklistVideoIfNeeded (parameters: { | |||
37 | defaults: videoBlacklistToCreate, | 39 | defaults: videoBlacklistToCreate, |
38 | transaction | 40 | transaction |
39 | }) | 41 | }) |
40 | |||
41 | video.VideoBlacklist = videoBlacklist | 42 | video.VideoBlacklist = videoBlacklist |
42 | 43 | ||
44 | if (notify) Notifier.Instance.notifyOnVideoAutoBlacklist(video) | ||
45 | |||
43 | logger.info('Video %s auto-blacklisted.', video.uuid) | 46 | logger.info('Video %s auto-blacklisted.', video.uuid) |
44 | 47 | ||
45 | return true | 48 | return true |