diff options
author | Chocobozzz <me@florianbigard.com> | 2017-12-12 17:53:50 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2017-12-13 16:50:33 +0100 |
commit | 3fd3ab2d34d512b160a5e6084d7609be7b4f4452 (patch) | |
tree | e5ca358287fca6ecacce83defcf23af1e8e9f419 /server/lib/activitypub/process/process-accept.ts | |
parent | c893d4514e6ecbf282c7985fe5f82b8acd8a1137 (diff) | |
download | PeerTube-3fd3ab2d34d512b160a5e6084d7609be7b4f4452.tar.gz PeerTube-3fd3ab2d34d512b160a5e6084d7609be7b4f4452.tar.zst PeerTube-3fd3ab2d34d512b160a5e6084d7609be7b4f4452.zip |
Move models to typescript-sequelize
Diffstat (limited to 'server/lib/activitypub/process/process-accept.ts')
-rw-r--r-- | server/lib/activitypub/process/process-accept.ts | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/server/lib/activitypub/process/process-accept.ts b/server/lib/activitypub/process/process-accept.ts index 73c6cb279..5b321f771 100644 --- a/server/lib/activitypub/process/process-accept.ts +++ b/server/lib/activitypub/process/process-accept.ts | |||
@@ -1,12 +1,12 @@ | |||
1 | import { ActivityAccept } from '../../../../shared/models/activitypub/activity' | 1 | import { ActivityAccept } from '../../../../shared/models/activitypub' |
2 | import { database as db } from '../../../initializers' | 2 | import { AccountModel } from '../../../models/account/account' |
3 | import { AccountInstance } from '../../../models/account/account-interface' | 3 | import { AccountFollowModel } from '../../../models/account/account-follow' |
4 | import { addFetchOutboxJob } from '../fetch' | 4 | import { addFetchOutboxJob } from '../fetch' |
5 | 5 | ||
6 | async function processAcceptActivity (activity: ActivityAccept, inboxAccount?: AccountInstance) { | 6 | async function processAcceptActivity (activity: ActivityAccept, inboxAccount?: AccountModel) { |
7 | if (inboxAccount === undefined) throw new Error('Need to accept on explicit inbox.') | 7 | if (inboxAccount === undefined) throw new Error('Need to accept on explicit inbox.') |
8 | 8 | ||
9 | const targetAccount = await db.Account.loadByUrl(activity.actor) | 9 | const targetAccount = await AccountModel.loadByUrl(activity.actor) |
10 | 10 | ||
11 | return processAccept(inboxAccount, targetAccount) | 11 | return processAccept(inboxAccount, targetAccount) |
12 | } | 12 | } |
@@ -19,8 +19,8 @@ export { | |||
19 | 19 | ||
20 | // --------------------------------------------------------------------------- | 20 | // --------------------------------------------------------------------------- |
21 | 21 | ||
22 | async function processAccept (account: AccountInstance, targetAccount: AccountInstance) { | 22 | async function processAccept (account: AccountModel, targetAccount: AccountModel) { |
23 | const follow = await db.AccountFollow.loadByAccountAndTarget(account.id, targetAccount.id) | 23 | const follow = await AccountFollowModel.loadByAccountAndTarget(account.id, targetAccount.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') |