X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Flib%2Fvideo-blacklist.ts;h=dbb37e0b28b70915c87615c4118066ba04770fbc;hb=2498aaead1fb4f34c8c375ef9edff33456c4527a;hp=1ee92d22c61ea6faa39f3c7598f861f513feb234;hpb=3487330d308166afb542cbacae0475693c0b059e;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/lib/video-blacklist.ts b/server/lib/video-blacklist.ts index 1ee92d22c..dbb37e0b2 100644 --- a/server/lib/video-blacklist.ts +++ b/server/lib/video-blacklist.ts @@ -1,4 +1,5 @@ import { Transaction } from 'sequelize' +import { afterCommitIfTransaction } from '@server/helpers/database-utils' import { sequelizeTypescript } from '@server/initializers/database' import { MUser, @@ -7,7 +8,7 @@ import { MVideoBlacklistVideo, MVideoFullLight, MVideoWithBlacklistLight -} from '@server/typings/models' +} from '@server/types/models' import { UserRight, VideoBlacklistCreate, VideoBlacklistType } from '../../shared/models' import { UserAdminFlag } from '../../shared/models/users/user-flag.model' import { logger } from '../helpers/logger' @@ -15,6 +16,7 @@ import { CONFIG } from '../initializers/config' import { VideoBlacklistModel } from '../models/video/video-blacklist' import { sendDeleteVideo } from './activitypub/send' import { federateVideoIfNeeded } from './activitypub/videos' +import { LiveManager } from './live-manager' import { Notifier } from './notifier' import { Hooks } from './plugins/hooks' @@ -52,7 +54,11 @@ async function autoBlacklistVideoIfNeeded (parameters: { videoBlacklist.Video = video - if (notify) Notifier.Instance.notifyOnVideoAutoBlacklist(videoBlacklist) + if (notify) { + afterCommitIfTransaction(transaction, () => { + Notifier.Instance.notifyOnVideoAutoBlacklist(videoBlacklist) + }) + } logger.info('Video %s auto-blacklisted.', video.uuid) @@ -73,6 +79,10 @@ async function blacklistVideo (videoInstance: MVideoAccountLight, options: Video await sendDeleteVideo(videoInstance, undefined) } + if (videoInstance.isLive) { + LiveManager.Instance.stopSessionOf(videoInstance.id) + } + Notifier.Instance.notifyOnVideoBlacklist(blacklist) }