From f0484f7a16ba8d14f8ce788398467307f4d23e1d Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 4 Jan 2021 10:50:47 +0100 Subject: Fix autoblacklist notification issue --- server/lib/video-blacklist.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'server') 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 @@ import { Transaction } from 'sequelize' +import { afterCommitIfTransaction } from '@server/helpers/database-utils' import { sequelizeTypescript } from '@server/initializers/database' import { MUser, @@ -15,9 +16,9 @@ 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' -import { LiveManager } from './live-manager' async function autoBlacklistVideoIfNeeded (parameters: { video: MVideoWithBlacklistLight @@ -53,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) -- cgit v1.2.3