aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/video-blacklist.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-07-23 12:04:15 +0200
committerChocobozzz <chocobozzz@cpy.re>2019-07-24 10:58:16 +0200
commit5b77537ce54832f47931ba47dc513be2a9197f92 (patch)
tree4f968168f1346faa82ac6c9663778e1cca65b02a /server/lib/video-blacklist.ts
parentd8e9a42c4b048b2669ab6a61704682ce23fbcf99 (diff)
downloadPeerTube-5b77537ce54832f47931ba47dc513be2a9197f92.tar.gz
PeerTube-5b77537ce54832f47931ba47dc513be2a9197f92.tar.zst
PeerTube-5b77537ce54832f47931ba47dc513be2a9197f92.zip
Correctly notify on auto blacklist
Diffstat (limited to 'server/lib/video-blacklist.ts')
-rw-r--r--server/lib/video-blacklist.ts7
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'
7import { logger } from '../helpers/logger' 7import { logger } from '../helpers/logger'
8import { UserAdminFlag } from '../../shared/models/users/user-flag.model' 8import { UserAdminFlag } from '../../shared/models/users/user-flag.model'
9import { Hooks } from './plugins/hooks' 9import { Hooks } from './plugins/hooks'
10import { Notifier } from './notifier'
10 11
11async function autoBlacklistVideoIfNeeded (parameters: { 12async 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