aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/video-blacklist.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-01-04 10:50:47 +0100
committerChocobozzz <me@florianbigard.com>2021-01-04 10:50:47 +0100
commitf0484f7a16ba8d14f8ce788398467307f4d23e1d (patch)
treefa5c8bc62c9a6aabba816693cf3a21b60c177e12 /server/lib/video-blacklist.ts
parent4948dcdbeb4b097770167b50f2bddade6ae88370 (diff)
downloadPeerTube-f0484f7a16ba8d14f8ce788398467307f4d23e1d.tar.gz
PeerTube-f0484f7a16ba8d14f8ce788398467307f4d23e1d.tar.zst
PeerTube-f0484f7a16ba8d14f8ce788398467307f4d23e1d.zip
Fix autoblacklist notification issue
Diffstat (limited to 'server/lib/video-blacklist.ts')
-rw-r--r--server/lib/video-blacklist.ts9
1 files changed, 7 insertions, 2 deletions
diff --git a/server/lib/video-blacklist.ts b/server/lib/video-blacklist.ts
index f6c66b6dd..dbb37e0b2 100644
--- a/server/lib/video-blacklist.ts
+++ b/server/lib/video-blacklist.ts
@@ -1,4 +1,5 @@
1import { Transaction } from 'sequelize' 1import { Transaction } from 'sequelize'
2import { afterCommitIfTransaction } from '@server/helpers/database-utils'
2import { sequelizeTypescript } from '@server/initializers/database' 3import { sequelizeTypescript } from '@server/initializers/database'
3import { 4import {
4 MUser, 5 MUser,
@@ -15,9 +16,9 @@ import { CONFIG } from '../initializers/config'
15import { VideoBlacklistModel } from '../models/video/video-blacklist' 16import { VideoBlacklistModel } from '../models/video/video-blacklist'
16import { sendDeleteVideo } from './activitypub/send' 17import { sendDeleteVideo } from './activitypub/send'
17import { federateVideoIfNeeded } from './activitypub/videos' 18import { federateVideoIfNeeded } from './activitypub/videos'
19import { LiveManager } from './live-manager'
18import { Notifier } from './notifier' 20import { Notifier } from './notifier'
19import { Hooks } from './plugins/hooks' 21import { Hooks } from './plugins/hooks'
20import { LiveManager } from './live-manager'
21 22
22async function autoBlacklistVideoIfNeeded (parameters: { 23async function autoBlacklistVideoIfNeeded (parameters: {
23 video: MVideoWithBlacklistLight 24 video: MVideoWithBlacklistLight
@@ -53,7 +54,11 @@ async function autoBlacklistVideoIfNeeded (parameters: {
53 54
54 videoBlacklist.Video = video 55 videoBlacklist.Video = video
55 56
56 if (notify) Notifier.Instance.notifyOnVideoAutoBlacklist(videoBlacklist) 57 if (notify) {
58 afterCommitIfTransaction(transaction, () => {
59 Notifier.Instance.notifyOnVideoAutoBlacklist(videoBlacklist)
60 })
61 }
57 62
58 logger.info('Video %s auto-blacklisted.', video.uuid) 63 logger.info('Video %s auto-blacklisted.', video.uuid)
59 64