-import { Transaction } from 'sequelize'
-import { ActivityFollow } from '../../../../shared/models/activitypub/activity'
-import { AccountInstance } from '../../../models'
-import { AccountFollowInstance } from '../../../models/account/account-follow-interface'
-import { getAccountFollowActivityPubUrl } from '../url'
+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 './misc'
-function sendFollow (accountFollow: AccountFollowInstance, t: Transaction) {
- const me = accountFollow.AccountFollower
- const following = accountFollow.AccountFollowing
+function sendFollow (actorFollow: ActorFollowModel) {
+ const me = actorFollow.ActorFollower
+ const following = actorFollow.ActorFollowing
- const url = getAccountFollowActivityPubUrl(accountFollow)
+ const url = getActorFollowActivityPubUrl(actorFollow)
const data = followActivityData(url, me, following)
- return unicastTo(data, me, following.inboxUrl, t)
+ return unicastTo(data, me, following.inboxUrl)
}
-function followActivityData (url: string, byAccount: AccountInstance, targetAccount: AccountInstance) {
- const activity: ActivityFollow = {
+function followActivityData (url: string, byActor: ActorModel, targetActor: ActorModel): ActivityFollow {
+ return {
type: 'Follow',
id: url,
- actor: byAccount.url,
- object: targetAccount.url
+ actor: byActor.url,
+ object: targetActor.url
}
-
- return activity
}
// ---------------------------------------------------------------------------