X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Flib%2Factivitypub%2Fsend%2Fsend-accept.ts;h=7579884a79ca43f241a5d325e9bfda903f1918e9;hb=ce33ee01cd3806201b676c318e9aa930032921b2;hp=0324a30fa02397d46d87d150ff234317c1cf093f;hpb=54141398354e6e7b94aa3065a705a1251390111c;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/lib/activitypub/send/send-accept.ts b/server/lib/activitypub/send/send-accept.ts index 0324a30fa..7579884a7 100644 --- a/server/lib/activitypub/send/send-accept.ts +++ b/server/lib/activitypub/send/send-accept.ts @@ -1,16 +1,16 @@ import { Transaction } from 'sequelize' -import { ActivityAccept } from '../../../../shared/models/activitypub/activity' -import { AccountInstance } from '../../../models' -import { AccountFollowInstance } from '../../../models/account/account-follow-interface' +import { ActivityAccept } from '../../../../shared/models/activitypub' +import { ActorModel } from '../../../models/activitypub/actor' +import { ActorFollowModel } from '../../../models/activitypub/actor-follow' +import { getActorFollowAcceptActivityPubUrl } from '../url' import { unicastTo } from './misc' -import { getAccountFollowAcceptActivityPubUrl } from '../../../helpers/activitypub' -async function sendAccept (accountFollow: AccountFollowInstance, t: Transaction) { - const follower = accountFollow.AccountFollower - const me = accountFollow.AccountFollowing +async function sendAccept (actorFollow: ActorFollowModel, t: Transaction) { + const follower = actorFollow.ActorFollower + const me = actorFollow.ActorFollowing - const url = getAccountFollowAcceptActivityPubUrl(accountFollow) - const data = await acceptActivityData(url, me) + const url = getActorFollowAcceptActivityPubUrl(actorFollow) + const data = acceptActivityData(url, me) return unicastTo(data, me, follower.inboxUrl, t) } @@ -23,12 +23,10 @@ export { // --------------------------------------------------------------------------- -async function acceptActivityData (url: string, byAccount: AccountInstance) { - const activity: ActivityAccept = { +function acceptActivityData (url: string, byActor: ActorModel): ActivityAccept { + return { type: 'Accept', id: url, - actor: byAccount.url + actor: byActor.url } - - return activity }