aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-11-23 14:19:55 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-11-27 19:40:53 +0100
commit0032ebe94aa83fab761c7de3ceb6210ac4532824 (patch)
tree3ea407d7ea6de4c7f7bc66caba7e23c0cc4036e3 /server/controllers/api
parentd52eb8f656242c7e34afdb2dee681861fb9bce35 (diff)
downloadPeerTube-0032ebe94aa83fab761c7de3ceb6210ac4532824.tar.gz
PeerTube-0032ebe94aa83fab761c7de3ceb6210ac4532824.tar.zst
PeerTube-0032ebe94aa83fab761c7de3ceb6210ac4532824.zip
Federate likes/dislikes
Diffstat (limited to 'server/controllers/api')
-rw-r--r--server/controllers/api/videos/rate.ts7
1 files changed, 4 insertions, 3 deletions
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'
3import { logger, retryTransactionWrapper } from '../../../helpers' 3import { logger, retryTransactionWrapper } from '../../../helpers'
4import { VIDEO_RATE_TYPES } from '../../../initializers' 4import { VIDEO_RATE_TYPES } from '../../../initializers'
5import { database as db } from '../../../initializers/database' 5import { database as db } from '../../../initializers/database'
6import { sendVideoRateChangeToFollowers, sendVideoRateChangeToOrigin } from '../../../lib/activitypub/videos'
6import { asyncMiddleware, authenticate, videoRateValidator } from '../../../middlewares' 7import { asyncMiddleware, authenticate, videoRateValidator } from '../../../middlewares'
7import { AccountInstance } from '../../../models/account/account-interface' 8import { AccountInstance } from '../../../models/account/account-interface'
8import { VideoInstance } from '../../../models/video/video-interface' 9import { VideoInstance } from '../../../models/video/video-interface'
@@ -82,10 +83,10 @@ async function rateVideo (req: express.Request, res: express.Response) {
82 // It is useful for the user to have a feedback 83 // It is useful for the user to have a feedback
83 await videoInstance.increment(incrementQuery, sequelizeOptions) 84 await videoInstance.increment(incrementQuery, sequelizeOptions)
84 85
85 if (videoInstance.isOwned() === false) { 86 if (videoInstance.isOwned()) {
86 // TODO: Send a event to original server 87 await sendVideoRateChangeToFollowers(accountInstance, videoInstance, likesToIncrement, dislikesToIncrement, t)
87 } else { 88 } else {
88 // TODO: Send update to followers 89 await sendVideoRateChangeToOrigin(accountInstance, videoInstance, likesToIncrement, dislikesToIncrement, t)
89 } 90 }
90 }) 91 })
91 92