From 77de223a5f5aca1dc32e23ca22a8ac7d8b009c4f Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 24 Jul 2018 15:11:28 +0200 Subject: [PATCH] Fix publishedAt after a scheduled update --- server/lib/schedulers/update-videos-scheduler.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server/lib/schedulers/update-videos-scheduler.ts b/server/lib/schedulers/update-videos-scheduler.ts index 760475af9..fd2edfd17 100644 --- a/server/lib/schedulers/update-videos-scheduler.ts +++ b/server/lib/schedulers/update-videos-scheduler.ts @@ -43,11 +43,12 @@ export class UpdateVideosScheduler extends AbstractScheduler { if (schedule.privacy) { const oldPrivacy = video.privacy + const isNewVideo = oldPrivacy === VideoPrivacy.PRIVATE video.privacy = schedule.privacy - await video.save({ transaction: t }) + if (isNewVideo === true) video.publishedAt = new Date() - const isNewVideo = oldPrivacy === VideoPrivacy.PRIVATE + await video.save({ transaction: t }) await federateVideoIfNeeded(video, isNewVideo, t) }