aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares
diff options
context:
space:
mode:
Diffstat (limited to 'server/middlewares')
-rw-r--r--server/middlewares/validators/follows.ts15
1 files changed, 9 insertions, 6 deletions
diff --git a/server/middlewares/validators/follows.ts b/server/middlewares/validators/follows.ts
index ef4151efe..38df39fda 100644
--- a/server/middlewares/validators/follows.ts
+++ b/server/middlewares/validators/follows.ts
@@ -9,7 +9,6 @@ import { ActorFollowModel } from '../../models/activitypub/actor-follow'
9import { areValidationErrors } from './utils' 9import { areValidationErrors } from './utils'
10import { ActorModel } from '../../models/activitypub/actor' 10import { ActorModel } from '../../models/activitypub/actor'
11import { loadActorUrlOrGetFromWebfinger } from '../../helpers/webfinger' 11import { loadActorUrlOrGetFromWebfinger } from '../../helpers/webfinger'
12import { getOrCreateActorAndServerAndModel } from '../../lib/activitypub'
13import { isValidActorHandle } from '../../helpers/custom-validators/activitypub/actor' 12import { isValidActorHandle } from '../../helpers/custom-validators/activitypub/actor'
14 13
15const followValidator = [ 14const followValidator = [
@@ -66,12 +65,16 @@ const removeFollowerValidator = [
66 65
67 if (areValidationErrors(req, res)) return 66 if (areValidationErrors(req, res)) return
68 67
69 const serverActor = await getServerActor() 68 let follow: ActorFollowModel
70 69 try {
71 const actorUrl = await loadActorUrlOrGetFromWebfinger(req.params.nameWithHost) 70 const actorUrl = await loadActorUrlOrGetFromWebfinger(req.params.nameWithHost)
72 const actor = await ActorModel.loadByUrl(actorUrl) 71 const actor = await ActorModel.loadByUrl(actorUrl)
73 72
74 const follow = await ActorFollowModel.loadByActorAndTarget(actor.id, serverActor.id) 73 const serverActor = await getServerActor()
74 follow = await ActorFollowModel.loadByActorAndTarget(actor.id, serverActor.id)
75 } catch (err) {
76 logger.warn('Cannot get actor from handle.', { handle: req.params.nameWithHost, err })
77 }
75 78
76 if (!follow) { 79 if (!follow) {
77 return res 80 return res