X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Flib%2Factivitypub%2Fsend%2Fsend-follow.ts;h=eac60e94f4f47877fe21645f86d13bf43dca7e69;hb=ce33ee01cd3806201b676c318e9aa930032921b2;hp=48d641c22d1f085e9b7a8fb4810054dda1db5890;hpb=54141398354e6e7b94aa3065a705a1251390111c;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/lib/activitypub/send/send-follow.ts b/server/lib/activitypub/send/send-follow.ts index 48d641c22..eac60e94f 100644 --- a/server/lib/activitypub/send/send-follow.ts +++ b/server/lib/activitypub/send/send-follow.ts @@ -1,29 +1,27 @@ import { Transaction } from 'sequelize' -import { ActivityFollow } from '../../../../shared/models/activitypub/activity' -import { AccountInstance } from '../../../models' -import { AccountFollowInstance } from '../../../models/account/account-follow-interface' +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' -import { getAccountFollowActivityPubUrl } from '../../../helpers/activitypub' -async function sendFollow (accountFollow: AccountFollowInstance, t: Transaction) { - const me = accountFollow.AccountFollower - const following = accountFollow.AccountFollowing +function sendFollow (actorFollow: ActorFollowModel, t: Transaction) { + const me = actorFollow.ActorFollower + const following = actorFollow.ActorFollowing - const url = getAccountFollowActivityPubUrl(accountFollow) - const data = await followActivityData(url, me, following) + const url = getActorFollowActivityPubUrl(actorFollow) + const data = followActivityData(url, me, following) return unicastTo(data, me, following.inboxUrl, t) } -async 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 } // ---------------------------------------------------------------------------