]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/controllers/api/video-channel.ts
Upgrade server dependencies
[github/Chocobozzz/PeerTube.git] / server / controllers / api / video-channel.ts
index 3d6a6af7f53b1a9cb8e59bc58c6b38aebd674681..db7602139540d85a99963e91f9754c3f489cf167 100644 (file)
@@ -30,6 +30,7 @@ import { updateActorAvatarFile } from '../../lib/avatar'
 import { auditLoggerFactory, getAuditIdFromRes, VideoChannelAuditView } from '../../helpers/audit-logger'
 import { resetSequelizeInstance } from '../../helpers/database-utils'
 import { UserModel } from '../../models/account/user'
+import { JobQueue } from '../../lib/job-queue'
 
 const auditLogger = auditLoggerFactory('channels')
 const reqAvatarFile = createReqFiles([ 'avatarfile' ], MIMETYPES.IMAGE.MIMETYPE_EXT, { avatarfile: CONFIG.STORAGE.TMP_DIR })
@@ -197,6 +198,11 @@ async function removeVideoChannel (req: express.Request, res: express.Response)
 async function getVideoChannel (req: express.Request, res: express.Response, next: express.NextFunction) {
   const videoChannelWithVideos = await VideoChannelModel.loadAndPopulateAccountAndVideos(res.locals.videoChannel.id)
 
+  if (videoChannelWithVideos.isOutdated()) {
+    JobQueue.Instance.createJob({ type: 'activitypub-refresher', payload: { type: 'actor', url: videoChannelWithVideos.Actor.url } })
+            .catch(err => logger.error('Cannot create AP refresher job for actor %s.', videoChannelWithVideos.Actor.url, { err }))
+  }
+
   return res.json(videoChannelWithVideos.toFormattedJSON())
 }