Fix cc field in classic audience
This commit is contained in:
parent
ad9e39fb81
commit
16f29007dc
4 changed files with 21 additions and 28 deletions
|
@ -19,6 +19,8 @@ import { ActorModel } from '../../models/activitypub/actor'
|
||||||
import { AvatarModel } from '../../models/avatar/avatar'
|
import { AvatarModel } from '../../models/avatar/avatar'
|
||||||
import { ServerModel } from '../../models/server/server'
|
import { ServerModel } from '../../models/server/server'
|
||||||
import { VideoChannelModel } from '../../models/video/video-channel'
|
import { VideoChannelModel } from '../../models/video/video-channel'
|
||||||
|
import { JobQueue } from '../job-queue'
|
||||||
|
import { getServerActor } from '../../helpers/utils'
|
||||||
|
|
||||||
// Set account keys, this could be long so process after the account creation and do not block the client
|
// Set account keys, this could be long so process after the account creation and do not block the client
|
||||||
function setAsyncActorKeys (actor: ActorModel) {
|
function setAsyncActorKeys (actor: ActorModel) {
|
||||||
|
@ -169,6 +171,21 @@ async function fetchAvatarIfExists (actorJSON: ActivityPubActor) {
|
||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function addFetchOutboxJob (actor: ActorModel) {
|
||||||
|
// Don't fetch ourselves
|
||||||
|
const serverActor = await getServerActor()
|
||||||
|
if (serverActor.id === actor.id) {
|
||||||
|
logger.error('Cannot fetch our own outbox!')
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
|
||||||
|
const payload = {
|
||||||
|
uris: [ actor.outboxUrl ]
|
||||||
|
}
|
||||||
|
|
||||||
|
return JobQueue.Instance.createJob({ type: 'activitypub-http-fetcher', payload })
|
||||||
|
}
|
||||||
|
|
||||||
export {
|
export {
|
||||||
getOrCreateActorAndServerAndModel,
|
getOrCreateActorAndServerAndModel,
|
||||||
buildActorInstance,
|
buildActorInstance,
|
||||||
|
@ -176,7 +193,8 @@ export {
|
||||||
fetchActorTotalItems,
|
fetchActorTotalItems,
|
||||||
fetchAvatarIfExists,
|
fetchAvatarIfExists,
|
||||||
updateActorInstance,
|
updateActorInstance,
|
||||||
updateActorAvatarInstance
|
updateActorAvatarInstance,
|
||||||
|
addFetchOutboxJob
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
import { logger } from '../../helpers/logger'
|
|
||||||
import { getServerActor } from '../../helpers/utils'
|
|
||||||
import { ActorModel } from '../../models/activitypub/actor'
|
|
||||||
import { JobQueue } from '../job-queue'
|
|
||||||
|
|
||||||
async function addFetchOutboxJob (actor: ActorModel) {
|
|
||||||
// Don't fetch ourselves
|
|
||||||
const serverActor = await getServerActor()
|
|
||||||
if (serverActor.id === actor.id) {
|
|
||||||
logger.error('Cannot fetch our own outbox!')
|
|
||||||
return undefined
|
|
||||||
}
|
|
||||||
|
|
||||||
const payload = {
|
|
||||||
uris: [ actor.outboxUrl ]
|
|
||||||
}
|
|
||||||
|
|
||||||
return JobQueue.Instance.createJob({ type: 'activitypub-http-fetcher', payload })
|
|
||||||
}
|
|
||||||
|
|
||||||
export {
|
|
||||||
addFetchOutboxJob
|
|
||||||
}
|
|
|
@ -2,7 +2,7 @@ import { ActivityAccept } from '../../../../shared/models/activitypub'
|
||||||
import { getActorUrl } from '../../../helpers/activitypub'
|
import { getActorUrl } from '../../../helpers/activitypub'
|
||||||
import { ActorModel } from '../../../models/activitypub/actor'
|
import { ActorModel } from '../../../models/activitypub/actor'
|
||||||
import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
|
import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
|
||||||
import { addFetchOutboxJob } from '../fetch'
|
import { addFetchOutboxJob } from '../actor'
|
||||||
|
|
||||||
async function processAcceptActivity (activity: ActivityAccept, inboxActor?: ActorModel) {
|
async function processAcceptActivity (activity: ActivityAccept, inboxActor?: ActorModel) {
|
||||||
if (inboxActor === undefined) throw new Error('Need to accept on explicit inbox.')
|
if (inboxActor === undefined) throw new Error('Need to accept on explicit inbox.')
|
||||||
|
|
|
@ -139,9 +139,7 @@ async function getActorsInvolvedInVideo (video: VideoModel, t: Transaction) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getAudience (actorSender: ActorModel, t: Transaction, isPublic = true) {
|
async function getAudience (actorSender: ActorModel, t: Transaction, isPublic = true) {
|
||||||
const followerInboxUrls = await actorSender.getFollowerSharedInboxUrls(t)
|
return buildAudience([ actorSender.followersUrl ], isPublic)
|
||||||
|
|
||||||
return buildAudience(followerInboxUrls, isPublic)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildAudience (followerInboxUrls: string[], isPublic = true) {
|
function buildAudience (followerInboxUrls: string[], isPublic = true) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue