aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/activitypub/process/process-create.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-05-31 10:23:56 +0200
committerChocobozzz <me@florianbigard.com>2018-05-31 10:23:56 +0200
commit9588d4f49b7183631ddb97fa9c3cd79f9bfe2945 (patch)
treecbd0353ddc0129afa2c8827f27c0665c5c127225 /server/lib/activitypub/process/process-create.ts
parent3f9b33b02bed9e02af5520394e09805c46716101 (diff)
downloadPeerTube-9588d4f49b7183631ddb97fa9c3cd79f9bfe2945.tar.gz
PeerTube-9588d4f49b7183631ddb97fa9c3cd79f9bfe2945.tar.zst
PeerTube-9588d4f49b7183631ddb97fa9c3cd79f9bfe2945.zip
Correctly forward video related activities
Diffstat (limited to 'server/lib/activitypub/process/process-create.ts')
-rw-r--r--server/lib/activitypub/process/process-create.ts12
1 files changed, 4 insertions, 8 deletions
diff --git a/server/lib/activitypub/process/process-create.ts b/server/lib/activitypub/process/process-create.ts
index 99a5f6f9c..38dacf772 100644
--- a/server/lib/activitypub/process/process-create.ts
+++ b/server/lib/activitypub/process/process-create.ts
@@ -9,10 +9,9 @@ import { ActorModel } from '../../../models/activitypub/actor'
9import { VideoAbuseModel } from '../../../models/video/video-abuse' 9import { VideoAbuseModel } from '../../../models/video/video-abuse'
10import { VideoCommentModel } from '../../../models/video/video-comment' 10import { VideoCommentModel } from '../../../models/video/video-comment'
11import { getOrCreateActorAndServerAndModel } from '../actor' 11import { getOrCreateActorAndServerAndModel } from '../actor'
12import { getActorsInvolvedInVideo } from '../audience'
13import { resolveThread } from '../video-comments' 12import { resolveThread } from '../video-comments'
14import { getOrCreateAccountAndVideoAndChannel } from '../videos' 13import { getOrCreateAccountAndVideoAndChannel } from '../videos'
15import { forwardActivity } from '../send/utils' 14import { forwardActivity, forwardVideoRelatedActivity } from '../send/utils'
16 15
17async function processCreateActivity (activity: ActivityCreate) { 16async function processCreateActivity (activity: ActivityCreate) {
18 const activityObject = activity.object 17 const activityObject = activity.object
@@ -87,7 +86,8 @@ async function createVideoDislike (byActor: ActorModel, activity: ActivityCreate
87 if (video.isOwned() && created === true) { 86 if (video.isOwned() && created === true) {
88 // Don't resend the activity to the sender 87 // Don't resend the activity to the sender
89 const exceptions = [ byActor ] 88 const exceptions = [ byActor ]
90 await forwardActivity(activity, t, exceptions) 89
90 await forwardVideoRelatedActivity(activity, t, exceptions, video)
91 } 91 }
92 }) 92 })
93} 93}
@@ -190,11 +190,7 @@ async function createVideoComment (byActor: ActorModel, activity: ActivityCreate
190 // Don't resend the activity to the sender 190 // Don't resend the activity to the sender
191 const exceptions = [ byActor ] 191 const exceptions = [ byActor ]
192 192
193 // Mastodon does not add our announces in audience, so we forward to them manually 193 await forwardVideoRelatedActivity(activity, t, exceptions, video)
194 const additionalActors = await getActorsInvolvedInVideo(video, t)
195 const additionalFollowerUrls = additionalActors.map(a => a.followersUrl)
196
197 await forwardActivity(activity, t, exceptions, additionalFollowerUrls)
198 } 194 }
199 }) 195 })
200} 196}