diff options
Diffstat (limited to 'server/middlewares/validators/follows.ts')
-rw-r--r-- | server/middlewares/validators/follows.ts | 11 |
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 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { body, param } from 'express-validator/check' | 2 | import { body, param } from 'express-validator/check' |
3 | import { isTestInstance } from '../../helpers/core-utils' | 3 | import { getServerAccount, isTestInstance, logger } from '../../helpers' |
4 | import { isIdOrUUIDValid } from '../../helpers/custom-validators/misc' | ||
4 | import { isEachUniqueHostValid } from '../../helpers/custom-validators/servers' | 5 | import { isEachUniqueHostValid } from '../../helpers/custom-validators/servers' |
5 | import { logger } from '../../helpers/logger' | 6 | import { CONFIG } from '../../initializers' |
6 | import { CONFIG, database as db } from '../../initializers' | 7 | import { AccountFollowModel } from '../../models/account/account-follow' |
7 | import { areValidationErrors } from './utils' | 8 | import { areValidationErrors } from './utils' |
8 | import { getServerAccount } from '../../helpers/utils' | ||
9 | import { isIdOrUUIDValid } from '../../helpers/custom-validators/misc' | ||
10 | 9 | ||
11 | const followValidator = [ | 10 | const 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) |