From 0032ebe94aa83fab761c7de3ceb6210ac4532824 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 23 Nov 2017 14:19:55 +0100 Subject: Federate likes/dislikes --- server/controllers/api/videos/rate.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'server/controllers/api/videos/rate.ts') diff --git a/server/controllers/api/videos/rate.ts b/server/controllers/api/videos/rate.ts index 8216dffd2..134284df7 100644 --- a/server/controllers/api/videos/rate.ts +++ b/server/controllers/api/videos/rate.ts @@ -3,6 +3,7 @@ import { UserVideoRateUpdate } from '../../../../shared' import { logger, retryTransactionWrapper } from '../../../helpers' import { VIDEO_RATE_TYPES } from '../../../initializers' import { database as db } from '../../../initializers/database' +import { sendVideoRateChangeToFollowers, sendVideoRateChangeToOrigin } from '../../../lib/activitypub/videos' import { asyncMiddleware, authenticate, videoRateValidator } from '../../../middlewares' import { AccountInstance } from '../../../models/account/account-interface' import { VideoInstance } from '../../../models/video/video-interface' @@ -82,10 +83,10 @@ async function rateVideo (req: express.Request, res: express.Response) { // It is useful for the user to have a feedback await videoInstance.increment(incrementQuery, sequelizeOptions) - if (videoInstance.isOwned() === false) { - // TODO: Send a event to original server + if (videoInstance.isOwned()) { + await sendVideoRateChangeToFollowers(accountInstance, videoInstance, likesToIncrement, dislikesToIncrement, t) } else { - // TODO: Send update to followers + await sendVideoRateChangeToOrigin(accountInstance, videoInstance, likesToIncrement, dislikesToIncrement, t) } }) -- cgit v1.2.3