- if (follow.state !== 'pending') {
- return res
- .status(HttpStatusCode.BAD_REQUEST_400)
- .json({
- error: 'Follow is not in pending state.'
- })
- .end()
+ if (follow.state !== 'pending' && follow.state !== 'rejected') {
+ return res.fail({ message: 'Follow is not in pending/rejected state.' })
+ }
+
+ return next()
+ }
+]
+
+const rejectFollowerValidator = [
+ (req: express.Request, res: express.Response, next: express.NextFunction) => {
+ logger.debug('Checking reject follower parameters', { parameters: req.params })
+
+ const follow = res.locals.follow
+ if (follow.state !== 'pending' && follow.state !== 'accepted') {
+ return res.fail({ message: 'Follow is not in pending/accepted state.' })