aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/job-queue
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/job-queue')
-rw-r--r--server/lib/job-queue/handlers/activitypub-follow.ts15
1 files changed, 9 insertions, 6 deletions
diff --git a/server/lib/job-queue/handlers/activitypub-follow.ts b/server/lib/job-queue/handlers/activitypub-follow.ts
index 282dde268..36d0f237b 100644
--- a/server/lib/job-queue/handlers/activitypub-follow.ts
+++ b/server/lib/job-queue/handlers/activitypub-follow.ts
@@ -1,7 +1,6 @@
1import * as Bull from 'bull' 1import * as Bull from 'bull'
2import { logger } from '../../../helpers/logger' 2import { logger } from '../../../helpers/logger'
3import { getServerActor } from '../../../helpers/utils' 3import { CONFIG, REMOTE_SCHEME, sequelizeTypescript } from '../../../initializers'
4import { REMOTE_SCHEME, sequelizeTypescript } from '../../../initializers'
5import { sendFollow } from '../../activitypub/send' 4import { sendFollow } from '../../activitypub/send'
6import { sanitizeHost } from '../../../helpers/core-utils' 5import { sanitizeHost } from '../../../helpers/core-utils'
7import { loadActorUrlOrGetFromWebfinger } from '../../../helpers/webfinger' 6import { loadActorUrlOrGetFromWebfinger } from '../../../helpers/webfinger'
@@ -22,10 +21,14 @@ async function processActivityPubFollow (job: Bull.Job) {
22 21
23 logger.info('Processing ActivityPub follow in job %d.', job.id) 22 logger.info('Processing ActivityPub follow in job %d.', job.id)
24 23
25 const sanitizedHost = sanitizeHost(host, REMOTE_SCHEME.HTTP) 24 let targetActor: ActorModel
26 25 if (!host || host === CONFIG.WEBSERVER.HOST) {
27 const actorUrl = await loadActorUrlOrGetFromWebfinger(payload.name + '@' + sanitizedHost) 26 targetActor = await ActorModel.loadLocalByName(payload.name)
28 const targetActor = await getOrCreateActorAndServerAndModel(actorUrl) 27 } else {
28 const sanitizedHost = sanitizeHost(host, REMOTE_SCHEME.HTTP)
29 const actorUrl = await loadActorUrlOrGetFromWebfinger(payload.name + '@' + sanitizedHost)
30 targetActor = await getOrCreateActorAndServerAndModel(actorUrl)
31 }
29 32
30 const fromActor = await ActorModel.load(payload.followerActorId) 33 const fromActor = await ActorModel.load(payload.followerActorId)
31 34