aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/api')
-rw-r--r--server/controllers/api/videos/index.ts8
-rw-r--r--server/controllers/api/videos/rate.ts8
2 files changed, 4 insertions, 12 deletions
diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts
index 690872320..552e5edac 100644
--- a/server/controllers/api/videos/index.ts
+++ b/server/controllers/api/videos/index.ts
@@ -20,7 +20,7 @@ import {
20 VIDEO_PRIVACIES 20 VIDEO_PRIVACIES
21} from '../../../initializers' 21} from '../../../initializers'
22import { fetchRemoteVideoDescription, getVideoActivityPubUrl, shareVideoByServerAndChannel } from '../../../lib/activitypub' 22import { fetchRemoteVideoDescription, getVideoActivityPubUrl, shareVideoByServerAndChannel } from '../../../lib/activitypub'
23import { sendCreateVideo, sendCreateViewToOrigin, sendCreateViewToVideoFollowers, sendUpdateVideo } from '../../../lib/activitypub/send' 23import { sendCreateVideo, sendCreateView, sendUpdateVideo } from '../../../lib/activitypub/send'
24import { JobQueue } from '../../../lib/job-queue' 24import { JobQueue } from '../../../lib/job-queue'
25import { Redis } from '../../../lib/redis' 25import { Redis } from '../../../lib/redis'
26import { 26import {
@@ -365,11 +365,7 @@ async function viewVideo (req: express.Request, res: express.Response) {
365 365
366 const serverAccount = await getServerActor() 366 const serverAccount = await getServerActor()
367 367
368 if (videoInstance.isOwned()) { 368 await sendCreateView(serverAccount, videoInstance, undefined)
369 await sendCreateViewToVideoFollowers(serverAccount, videoInstance, undefined)
370 } else {
371 await sendCreateViewToOrigin(serverAccount, videoInstance, undefined)
372 }
373 369
374 return res.status(204).end() 370 return res.status(204).end()
375} 371}
diff --git a/server/controllers/api/videos/rate.ts b/server/controllers/api/videos/rate.ts
index a7bd570eb..23e9de9f3 100644
--- a/server/controllers/api/videos/rate.ts
+++ b/server/controllers/api/videos/rate.ts
@@ -3,7 +3,7 @@ import { UserVideoRateUpdate } from '../../../../shared'
3import { retryTransactionWrapper } from '../../../helpers/database-utils' 3import { retryTransactionWrapper } from '../../../helpers/database-utils'
4import { logger } from '../../../helpers/logger' 4import { logger } from '../../../helpers/logger'
5import { sequelizeTypescript, VIDEO_RATE_TYPES } from '../../../initializers' 5import { sequelizeTypescript, VIDEO_RATE_TYPES } from '../../../initializers'
6import { sendVideoRateChangeToFollowers, sendVideoRateChangeToOrigin } from '../../../lib/activitypub' 6import { sendVideoRateChange } from '../../../lib/activitypub'
7import { asyncMiddleware, authenticate, videoRateValidator } from '../../../middlewares' 7import { asyncMiddleware, authenticate, videoRateValidator } from '../../../middlewares'
8import { AccountModel } from '../../../models/account/account' 8import { AccountModel } from '../../../models/account/account'
9import { AccountVideoRateModel } from '../../../models/account/account-video-rate' 9import { AccountVideoRateModel } from '../../../models/account/account-video-rate'
@@ -83,11 +83,7 @@ async function rateVideo (req: express.Request, res: express.Response) {
83 // It is useful for the user to have a feedback 83 // It is useful for the user to have a feedback
84 await videoInstance.increment(incrementQuery, sequelizeOptions) 84 await videoInstance.increment(incrementQuery, sequelizeOptions)
85 85
86 if (videoInstance.isOwned()) { 86 await sendVideoRateChange(accountInstance, videoInstance, likesToIncrement, dislikesToIncrement, t)
87 await sendVideoRateChangeToFollowers(accountInstance, videoInstance, likesToIncrement, dislikesToIncrement, t)
88 } else {
89 await sendVideoRateChangeToOrigin(accountInstance, videoInstance, likesToIncrement, dislikesToIncrement, t)
90 }
91 }) 87 })
92 88
93 logger.info('Account video rate for video %s of account %s updated.', videoInstance.name, accountInstance.name) 89 logger.info('Account video rate for video %s of account %s updated.', videoInstance.name, accountInstance.name)