From e8d246d5267ea8b6b3114d4bcf4f34fe5f3a5241 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 28 Dec 2018 13:47:17 +0100 Subject: Add notification settings migration --- server/lib/activitypub/videos.ts | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'server/lib/activitypub') diff --git a/server/lib/activitypub/videos.ts b/server/lib/activitypub/videos.ts index 5794988a5..893768769 100644 --- a/server/lib/activitypub/videos.ts +++ b/server/lib/activitypub/videos.ts @@ -204,19 +204,17 @@ async function updateVideoFromAP (options: { overrideTo?: string[] }) { logger.debug('Updating remote video "%s".', options.videoObject.uuid) + let videoFieldsSave: any + const wasPrivateVideo = options.video.privacy === VideoPrivacy.PRIVATE + const wasUnlistedVideo = options.video.privacy === VideoPrivacy.UNLISTED try { await sequelizeTypescript.transaction(async t => { - const sequelizeOptions = { - transaction: t - } + const sequelizeOptions = { transaction: t } videoFieldsSave = options.video.toJSON() - const wasPrivateVideo = options.video.privacy === VideoPrivacy.PRIVATE - const wasUnlistedVideo = options.video.privacy === VideoPrivacy.UNLISTED - // Check actor has the right to update the video const videoChannel = options.video.VideoChannel if (videoChannel.Account.id !== options.account.id) { @@ -281,15 +279,13 @@ async function updateVideoFromAP (options: { }) options.video.VideoCaptions = await Promise.all(videoCaptionsPromises) } - - { - // Notify our users? - if (wasPrivateVideo || wasUnlistedVideo) { - Notifier.Instance.notifyOnNewVideo(options.video) - } - } }) + // Notify our users? + if (wasPrivateVideo || wasUnlistedVideo) { + Notifier.Instance.notifyOnNewVideo(options.video) + } + logger.info('Remote video with uuid %s updated', options.videoObject.uuid) } catch (err) { if (options.video !== undefined && videoFieldsSave !== undefined) { -- cgit v1.2.3