X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmiddlewares%2Fvalidators%2Ffollows.ts;h=bdf39eb9c543389b58139d87e8e5339e822b6c54;hb=7279b455811f4806dcb74a08d17b837bc22533c1;hp=2240d30dba8acfe181f0104043aa1d1040e5e82a;hpb=50d6de9c286abcb34ff4234d56d9cbb803db7665;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/middlewares/validators/follows.ts b/server/middlewares/validators/follows.ts index 2240d30db..bdf39eb9c 100644 --- a/server/middlewares/validators/follows.ts +++ b/server/middlewares/validators/follows.ts @@ -1,7 +1,9 @@ import * as express from 'express' import { body, param } from 'express-validator/check' -import { getServerActor, isTestInstance, logger } from '../../helpers' +import { isTestInstance } from '../../helpers/core-utils' import { isEachUniqueHostValid, isHostValid } from '../../helpers/custom-validators/servers' +import { logger } from '../../helpers/logger' +import { getServerActor } from '../../helpers/utils' import { CONFIG } from '../../initializers' import { ActorFollowModel } from '../../models/activitypub/actor-follow' import { areValidationErrors } from './utils' @@ -14,7 +16,7 @@ const followValidator = [ if (isTestInstance() === false && CONFIG.WEBSERVER.SCHEME === 'http') { return res.status(400) .json({ - error: 'Cannot follow non HTTPS web server.' + error: 'Cannot follow on a non HTTPS web server.' }) .end() } @@ -39,7 +41,11 @@ const removeFollowingValidator = [ const follow = await ActorFollowModel.loadByActorAndTargetHost(serverActor.id, req.params.host) if (!follow) { - return res.status(404) + return res + .status(404) + .json({ + error: `Follower ${req.params.host} not found.` + }) .end() }