mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-04 18:29:27 +02:00
Begin moving video channel to actor
This commit is contained in:
parent
fadf619ad6
commit
50d6de9c28
100 changed files with 1761 additions and 2041 deletions
|
@ -1,14 +1,14 @@
|
|||
import { ActivityAccept } from '../../../../shared/models/activitypub'
|
||||
import { AccountModel } from '../../../models/account/account'
|
||||
import { AccountFollowModel } from '../../../models/account/account-follow'
|
||||
import { ActorModel } from '../../../models/activitypub/actor'
|
||||
import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
|
||||
import { addFetchOutboxJob } from '../fetch'
|
||||
|
||||
async function processAcceptActivity (activity: ActivityAccept, inboxAccount?: AccountModel) {
|
||||
if (inboxAccount === undefined) throw new Error('Need to accept on explicit inbox.')
|
||||
async function processAcceptActivity (activity: ActivityAccept, inboxActor?: ActorModel) {
|
||||
if (inboxActor === undefined) throw new Error('Need to accept on explicit inbox.')
|
||||
|
||||
const targetAccount = await AccountModel.loadByUrl(activity.actor)
|
||||
const targetActor = await ActorModel.loadByUrl(activity.actor)
|
||||
|
||||
return processAccept(inboxAccount, targetAccount)
|
||||
return processAccept(inboxActor, targetActor)
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
@ -19,11 +19,11 @@ export {
|
|||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
async function processAccept (account: AccountModel, targetAccount: AccountModel) {
|
||||
const follow = await AccountFollowModel.loadByAccountAndTarget(account.id, targetAccount.id)
|
||||
async function processAccept (actor: ActorModel, targetActor: ActorModel) {
|
||||
const follow = await ActorFollowModel.loadByActorAndTarget(actor.id, targetActor.id)
|
||||
if (!follow) throw new Error('Cannot find associated follow.')
|
||||
|
||||
follow.set('state', 'accepted')
|
||||
await follow.save()
|
||||
await addFetchOutboxJob(targetAccount, undefined)
|
||||
await addFetchOutboxJob(targetActor, undefined)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue