diff options
Diffstat (limited to 'server/middlewares/validators')
-rw-r--r-- | server/middlewares/validators/follows.ts | 15 |
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' | |||
9 | import { areValidationErrors } from './utils' | 9 | import { areValidationErrors } from './utils' |
10 | import { ActorModel } from '../../models/activitypub/actor' | 10 | import { ActorModel } from '../../models/activitypub/actor' |
11 | import { loadActorUrlOrGetFromWebfinger } from '../../helpers/webfinger' | 11 | import { loadActorUrlOrGetFromWebfinger } from '../../helpers/webfinger' |
12 | import { getOrCreateActorAndServerAndModel } from '../../lib/activitypub' | ||
13 | import { isValidActorHandle } from '../../helpers/custom-validators/activitypub/actor' | 12 | import { isValidActorHandle } from '../../helpers/custom-validators/activitypub/actor' |
14 | 13 | ||
15 | const followValidator = [ | 14 | const 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 |