aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators/follows.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/middlewares/validators/follows.ts')
-rw-r--r--server/middlewares/validators/follows.ts11
1 files changed, 5 insertions, 6 deletions
diff --git a/server/middlewares/validators/follows.ts b/server/middlewares/validators/follows.ts
index 605872ecf..10482e5d0 100644
--- a/server/middlewares/validators/follows.ts
+++ b/server/middlewares/validators/follows.ts
@@ -1,12 +1,11 @@
1import * as express from 'express' 1import * as express from 'express'
2import { body, param } from 'express-validator/check' 2import { body, param } from 'express-validator/check'
3import { isTestInstance } from '../../helpers/core-utils' 3import { getServerAccount, isTestInstance, logger } from '../../helpers'
4import { isIdOrUUIDValid } from '../../helpers/custom-validators/misc'
4import { isEachUniqueHostValid } from '../../helpers/custom-validators/servers' 5import { isEachUniqueHostValid } from '../../helpers/custom-validators/servers'
5import { logger } from '../../helpers/logger' 6import { CONFIG } from '../../initializers'
6import { CONFIG, database as db } from '../../initializers' 7import { AccountFollowModel } from '../../models/account/account-follow'
7import { areValidationErrors } from './utils' 8import { areValidationErrors } from './utils'
8import { getServerAccount } from '../../helpers/utils'
9import { isIdOrUUIDValid } from '../../helpers/custom-validators/misc'
10 9
11const followValidator = [ 10const followValidator = [
12 body('hosts').custom(isEachUniqueHostValid).withMessage('Should have an array of unique hosts'), 11 body('hosts').custom(isEachUniqueHostValid).withMessage('Should have an array of unique hosts'),
@@ -38,7 +37,7 @@ const removeFollowingValidator = [
38 if (areValidationErrors(req, res)) return 37 if (areValidationErrors(req, res)) return
39 38
40 const serverAccount = await getServerAccount() 39 const serverAccount = await getServerAccount()
41 const follow = await db.AccountFollow.loadByAccountAndTarget(serverAccount.id, req.params.accountId) 40 const follow = await AccountFollowModel.loadByAccountAndTarget(serverAccount.id, req.params.accountId)
42 41
43 if (!follow) { 42 if (!follow) {
44 return res.status(404) 43 return res.status(404)