]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/lib/activitypub/send/send-follow.ts
Merge branch 'release/3.2.0' into develop
[github/Chocobozzz/PeerTube.git] / server / lib / activitypub / send / send-follow.ts
index c6e7fe83d81946f8af1f608a238bb1ebbfc9d3cd..9219640ddaae85cb8733e5c5ff6d44d7a78b02ca 100644 (file)
@@ -1,12 +1,10 @@
+import { Transaction } from 'sequelize'
 import { ActivityFollow } from '../../../../shared/models/activitypub'
-import { ActorModel } from '../../../models/activitypub/actor'
-import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
-import { getActorFollowActivityPubUrl } from '../url'
-import { unicastTo } from './utils'
 import { logger } from '../../../helpers/logger'
-import { Transaction } from 'sequelize'
+import { MActor, MActorFollowActors } from '../../../types/models'
+import { unicastTo } from './utils'
 
-function sendFollow (actorFollow: ActorFollowModel, t: Transaction) {
+function sendFollow (actorFollow: MActorFollowActors, t: Transaction) {
   const me = actorFollow.ActorFollower
   const following = actorFollow.ActorFollowing
 
@@ -15,13 +13,12 @@ function sendFollow (actorFollow: ActorFollowModel, t: Transaction) {
 
   logger.info('Creating job to send follow request to %s.', following.url)
 
-  const url = getActorFollowActivityPubUrl(me, following)
-  const data = buildFollowActivity(url, me, following)
+  const data = buildFollowActivity(actorFollow.url, me, following)
 
   t.afterCommit(() => unicastTo(data, me, following.inboxUrl))
 }
 
-function buildFollowActivity (url: string, byActor: ActorModel, targetActor: ActorModel): ActivityFollow {
+function buildFollowActivity (url: string, byActor: MActor, targetActor: MActor): ActivityFollow {
   return {
     type: 'Follow',
     id: url,