diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-11-23 14:19:55 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-11-27 19:40:53 +0100 |
commit | 0032ebe94aa83fab761c7de3ceb6210ac4532824 (patch) | |
tree | 3ea407d7ea6de4c7f7bc66caba7e23c0cc4036e3 /server/controllers/api/videos | |
parent | d52eb8f656242c7e34afdb2dee681861fb9bce35 (diff) | |
download | PeerTube-0032ebe94aa83fab761c7de3ceb6210ac4532824.tar.gz PeerTube-0032ebe94aa83fab761c7de3ceb6210ac4532824.tar.zst PeerTube-0032ebe94aa83fab761c7de3ceb6210ac4532824.zip |
Federate likes/dislikes
Diffstat (limited to 'server/controllers/api/videos')
-rw-r--r-- | server/controllers/api/videos/rate.ts | 7 |
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' | |||
3 | import { logger, retryTransactionWrapper } from '../../../helpers' | 3 | import { logger, retryTransactionWrapper } from '../../../helpers' |
4 | import { VIDEO_RATE_TYPES } from '../../../initializers' | 4 | import { VIDEO_RATE_TYPES } from '../../../initializers' |
5 | import { database as db } from '../../../initializers/database' | 5 | import { database as db } from '../../../initializers/database' |
6 | import { sendVideoRateChangeToFollowers, sendVideoRateChangeToOrigin } from '../../../lib/activitypub/videos' | ||
6 | import { asyncMiddleware, authenticate, videoRateValidator } from '../../../middlewares' | 7 | import { asyncMiddleware, authenticate, videoRateValidator } from '../../../middlewares' |
7 | import { AccountInstance } from '../../../models/account/account-interface' | 8 | import { AccountInstance } from '../../../models/account/account-interface' |
8 | import { VideoInstance } from '../../../models/video/video-interface' | 9 | import { 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 | ||