]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/middlewares/validators/follows.ts
Speed up populate database script
[github/Chocobozzz/PeerTube.git] / server / middlewares / validators / follows.ts
index 2240d30dba8acfe181f0104043aa1d1040e5e82a..bdf39eb9c543389b58139d87e8e5339e822b6c54 100644 (file)
@@ -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()
     }