]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/controllers/api/videos/view.ts
Merge branch 'release/4.2.0' into develop
[github/Chocobozzz/PeerTube.git] / server / controllers / api / videos / view.ts
index e28cf371a9111b9adf22b72cbd7a071523645d93..dee1ec67cb3ac7fed158f8dc96ae3fc81429c9fc 100644 (file)
@@ -1,8 +1,6 @@
 import express from 'express'
-import { sendView } from '@server/lib/activitypub/send/send-view'
 import { Hooks } from '@server/lib/plugins/hooks'
 import { VideoViewsManager } from '@server/lib/views/video-views-manager'
-import { getServerActor } from '@server/models/application/application'
 import { MVideoId } from '@server/types/models'
 import { HttpStatusCode, VideoView } from '@shared/models'
 import { asyncMiddleware, methodsValidator, openapiOperationDoc, optionalAuthenticate, videoViewValidator } from '../../../middlewares'
@@ -28,12 +26,12 @@ export {
 // ---------------------------------------------------------------------------
 
 async function viewVideo (req: express.Request, res: express.Response) {
-  const video = res.locals.onlyVideo
+  const video = res.locals.onlyImmutableVideo
 
   const body = req.body as VideoView
 
   const ip = req.ip
-  const { successView, successViewer } = await VideoViewsManager.Instance.processLocalView({
+  const { successView } = await VideoViewsManager.Instance.processLocalView({
     video,
     ip,
     currentTime: body.currentTime,
@@ -41,15 +39,9 @@ async function viewVideo (req: express.Request, res: express.Response) {
   })
 
   if (successView) {
-    await sendView({ byActor: await getServerActor(), video, type: 'view' })
-
     Hooks.runAction('action:api.video.viewed', { video: video, ip, req, res })
   }
 
-  if (successViewer) {
-    await sendView({ byActor: await getServerActor(), video, type: 'viewer' })
-  }
-
   await updateUserHistoryIfNeeded(body, video, res)
 
   return res.status(HttpStatusCode.NO_CONTENT_204).end()