]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/lib/activitypub/send/send-accept.ts
Add ability to search a video with an URL
[github/Chocobozzz/PeerTube.git] / server / lib / activitypub / send / send-accept.ts
index 4eaa329d935cf81e2affa7b8710e891ec238eab1..ef679707bfe72df3d9332f531e8ee6691da53d2a 100644 (file)
@@ -1,22 +1,29 @@
-import { Transaction } from 'sequelize'
 import { ActivityAccept, ActivityFollow } from '../../../../shared/models/activitypub'
 import { ActorModel } from '../../../models/activitypub/actor'
 import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
 import { getActorFollowAcceptActivityPubUrl, getActorFollowActivityPubUrl } from '../url'
-import { unicastTo } from './misc'
+import { unicastTo } from './utils'
 import { followActivityData } from './send-follow'
+import { logger } from '../../../helpers/logger'
 
-async function sendAccept (actorFollow: ActorFollowModel, t: Transaction) {
+async function sendAccept (actorFollow: ActorFollowModel) {
   const follower = actorFollow.ActorFollower
   const me = actorFollow.ActorFollowing
 
+  if (!follower.serverId) { // This should never happen
+    logger.warn('Do not sending accept to local follower.')
+    return
+  }
+
+  logger.info('Creating job to accept follower %s.', follower.url)
+
   const followUrl = getActorFollowActivityPubUrl(actorFollow)
   const followData = followActivityData(followUrl, follower, me)
 
   const url = getActorFollowAcceptActivityPubUrl(actorFollow)
   const data = acceptActivityData(url, me, followData)
 
-  return unicastTo(data, me, follower.inboxUrl, t)
+  return unicastTo(data, me, follower.inboxUrl)
 }
 
 // ---------------------------------------------------------------------------