diff options
Diffstat (limited to 'server/lib/activitypub/process/process-accept.ts')
-rw-r--r-- | server/lib/activitypub/process/process-accept.ts | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/server/lib/activitypub/process/process-accept.ts b/server/lib/activitypub/process/process-accept.ts index 5b321f771..b9d906ec9 100644 --- a/server/lib/activitypub/process/process-accept.ts +++ b/server/lib/activitypub/process/process-accept.ts | |||
@@ -1,14 +1,14 @@ | |||
1 | import { ActivityAccept } from '../../../../shared/models/activitypub' | 1 | import { ActivityAccept } from '../../../../shared/models/activitypub' |
2 | import { AccountModel } from '../../../models/account/account' | 2 | import { ActorModel } from '../../../models/activitypub/actor' |
3 | import { AccountFollowModel } from '../../../models/account/account-follow' | 3 | import { ActorFollowModel } from '../../../models/activitypub/actor-follow' |
4 | import { addFetchOutboxJob } from '../fetch' | 4 | import { addFetchOutboxJob } from '../fetch' |
5 | 5 | ||
6 | async function processAcceptActivity (activity: ActivityAccept, inboxAccount?: AccountModel) { | 6 | async function processAcceptActivity (activity: ActivityAccept, inboxActor?: ActorModel) { |
7 | if (inboxAccount === undefined) throw new Error('Need to accept on explicit inbox.') | 7 | if (inboxActor === undefined) throw new Error('Need to accept on explicit inbox.') |
8 | 8 | ||
9 | const targetAccount = await AccountModel.loadByUrl(activity.actor) | 9 | const targetActor = await ActorModel.loadByUrl(activity.actor) |
10 | 10 | ||
11 | return processAccept(inboxAccount, targetAccount) | 11 | return processAccept(inboxActor, targetActor) |
12 | } | 12 | } |
13 | 13 | ||
14 | // --------------------------------------------------------------------------- | 14 | // --------------------------------------------------------------------------- |
@@ -19,11 +19,11 @@ export { | |||
19 | 19 | ||
20 | // --------------------------------------------------------------------------- | 20 | // --------------------------------------------------------------------------- |
21 | 21 | ||
22 | async function processAccept (account: AccountModel, targetAccount: AccountModel) { | 22 | async function processAccept (actor: ActorModel, targetActor: ActorModel) { |
23 | const follow = await AccountFollowModel.loadByAccountAndTarget(account.id, targetAccount.id) | 23 | const follow = await ActorFollowModel.loadByActorAndTarget(actor.id, targetActor.id) |
24 | if (!follow) throw new Error('Cannot find associated follow.') | 24 | if (!follow) throw new Error('Cannot find associated follow.') |
25 | 25 | ||
26 | follow.set('state', 'accepted') | 26 | follow.set('state', 'accepted') |
27 | await follow.save() | 27 | await follow.save() |
28 | await addFetchOutboxJob(targetAccount, undefined) | 28 | await addFetchOutboxJob(targetActor, undefined) |
29 | } | 29 | } |