]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/lib/activitypub/process/process-create.ts
Add concept of video state, and add ability to wait transcoding before
[github/Chocobozzz/PeerTube.git] / server / lib / activitypub / process / process-create.ts
index ee180b765d8338e584a0d684bf583250014e7244..38dacf772aae083ad5472eee2b33e3ec3f6e4445 100644 (file)
@@ -9,9 +9,9 @@ import { ActorModel } from '../../../models/activitypub/actor'
 import { VideoAbuseModel } from '../../../models/video/video-abuse'
 import { VideoCommentModel } from '../../../models/video/video-comment'
 import { getOrCreateActorAndServerAndModel } from '../actor'
-import { forwardActivity, getActorsInvolvedInVideo } from '../send/misc'
 import { resolveThread } from '../video-comments'
 import { getOrCreateAccountAndVideoAndChannel } from '../videos'
+import { forwardActivity, forwardVideoRelatedActivity } from '../send/utils'
 
 async function processCreateActivity (activity: ActivityCreate) {
   const activityObject = activity.object
@@ -86,7 +86,8 @@ async function createVideoDislike (byActor: ActorModel, activity: ActivityCreate
     if (video.isOwned() && created === true) {
       // Don't resend the activity to the sender
       const exceptions = [ byActor ]
-      await forwardActivity(activity, t, exceptions)
+
+      await forwardVideoRelatedActivity(activity, t, exceptions, video)
     }
   })
 }
@@ -189,11 +190,7 @@ async function createVideoComment (byActor: ActorModel, activity: ActivityCreate
       // Don't resend the activity to the sender
       const exceptions = [ byActor ]
 
-      // Mastodon does not add our announces in audience, so we forward to them manually
-      const additionalActors = await getActorsInvolvedInVideo(video, t)
-      const additionalFollowerUrls = additionalActors.map(a => a.followersUrl)
-
-      await forwardActivity(activity, t, exceptions, additionalFollowerUrls)
+      await forwardVideoRelatedActivity(activity, t, exceptions, video)
     }
   })
 }