aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/activitypub
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-01-15 14:52:33 +0100
committerChocobozzz <me@florianbigard.com>2019-01-15 14:59:40 +0100
commit1e7eb25f6cb6893db8f99ff40ef0509aa2a16614 (patch)
tree798937b32d894a3e1235e34398876ed875c1b72e /server/controllers/activitypub
parent848f499def54db2dd36437ef0dfb74dd5041c23b (diff)
downloadPeerTube-1e7eb25f6cb6893db8f99ff40ef0509aa2a16614.tar.gz
PeerTube-1e7eb25f6cb6893db8f99ff40ef0509aa2a16614.tar.zst
PeerTube-1e7eb25f6cb6893db8f99ff40ef0509aa2a16614.zip
Correctly send Flag/Dislike/View activities
Diffstat (limited to 'server/controllers/activitypub')
-rw-r--r--server/controllers/activitypub/client.ts15
1 files changed, 6 insertions, 9 deletions
diff --git a/server/controllers/activitypub/client.ts b/server/controllers/activitypub/client.ts
index 1a4e28dc8..7e87f6f3b 100644
--- a/server/controllers/activitypub/client.ts
+++ b/server/controllers/activitypub/client.ts
@@ -3,22 +3,18 @@ import * as express from 'express'
3import { VideoPrivacy, VideoRateType } from '../../../shared/models/videos' 3import { VideoPrivacy, VideoRateType } from '../../../shared/models/videos'
4import { activityPubCollectionPagination, activityPubContextify } from '../../helpers/activitypub' 4import { activityPubCollectionPagination, activityPubContextify } from '../../helpers/activitypub'
5import { CONFIG, ROUTE_CACHE_LIFETIME } from '../../initializers' 5import { CONFIG, ROUTE_CACHE_LIFETIME } from '../../initializers'
6import { buildAnnounceWithVideoAudience, buildDislikeActivity, buildLikeActivity } from '../../lib/activitypub/send' 6import { buildAnnounceWithVideoAudience, buildLikeActivity } from '../../lib/activitypub/send'
7import { audiencify, getAudience } from '../../lib/activitypub/audience' 7import { audiencify, getAudience } from '../../lib/activitypub/audience'
8import { buildCreateActivity } from '../../lib/activitypub/send/send-create' 8import { buildCreateActivity } from '../../lib/activitypub/send/send-create'
9import { 9import {
10 asyncMiddleware, 10 asyncMiddleware,
11 videosShareValidator,
12 executeIfActivityPub, 11 executeIfActivityPub,
13 localAccountValidator, 12 localAccountValidator,
14 localVideoChannelValidator, 13 localVideoChannelValidator,
15 videosCustomGetValidator 14 videosCustomGetValidator,
15 videosShareValidator
16} from '../../middlewares' 16} from '../../middlewares'
17import { 17import { getAccountVideoRateValidator, videoCommentGetValidator, videosGetValidator } from '../../middlewares/validators'
18 getAccountVideoRateValidator,
19 videoCommentGetValidator,
20 videosGetValidator
21} from '../../middlewares/validators'
22import { AccountModel } from '../../models/account/account' 18import { AccountModel } from '../../models/account/account'
23import { ActorModel } from '../../models/activitypub/actor' 19import { ActorModel } from '../../models/activitypub/actor'
24import { ActorFollowModel } from '../../models/activitypub/actor-follow' 20import { ActorFollowModel } from '../../models/activitypub/actor-follow'
@@ -40,6 +36,7 @@ import { VideoCaptionModel } from '../../models/video/video-caption'
40import { videoRedundancyGetValidator } from '../../middlewares/validators/redundancy' 36import { videoRedundancyGetValidator } from '../../middlewares/validators/redundancy'
41import { getServerActor } from '../../helpers/utils' 37import { getServerActor } from '../../helpers/utils'
42import { VideoRedundancyModel } from '../../models/redundancy/video-redundancy' 38import { VideoRedundancyModel } from '../../models/redundancy/video-redundancy'
39import { buildDislikeActivity } from '../../lib/activitypub/send/send-dislike'
43 40
44const activityPubClientRouter = express.Router() 41const activityPubClientRouter = express.Router()
45 42
@@ -156,7 +153,7 @@ function getAccountVideoRate (rateType: VideoRateType) {
156 const url = getRateUrl(rateType, byActor, accountVideoRate.Video) 153 const url = getRateUrl(rateType, byActor, accountVideoRate.Video)
157 const APObject = rateType === 'like' 154 const APObject = rateType === 'like'
158 ? buildLikeActivity(url, byActor, accountVideoRate.Video) 155 ? buildLikeActivity(url, byActor, accountVideoRate.Video)
159 : buildCreateActivity(url, byActor, buildDislikeActivity(url, byActor, accountVideoRate.Video)) 156 : buildDislikeActivity(url, byActor, accountVideoRate.Video)
160 157
161 return activityPubResponse(activityPubContextify(APObject), res) 158 return activityPubResponse(activityPubContextify(APObject), res)
162 } 159 }