diff options
Diffstat (limited to 'server/controllers')
-rw-r--r-- | server/controllers/api/server/follows.ts | 5 | ||||
-rw-r--r-- | server/controllers/api/server/redundancy.ts | 6 |
2 files changed, 11 insertions, 0 deletions
diff --git a/server/controllers/api/server/follows.ts b/server/controllers/api/server/follows.ts index a4eae6b45..d62400e42 100644 --- a/server/controllers/api/server/follows.ts +++ b/server/controllers/api/server/follows.ts | |||
@@ -17,6 +17,7 @@ import { | |||
17 | import { followersSortValidator, followingSortValidator, followValidator } from '../../../middlewares/validators' | 17 | import { followersSortValidator, followingSortValidator, followValidator } from '../../../middlewares/validators' |
18 | import { ActorFollowModel } from '../../../models/activitypub/actor-follow' | 18 | import { ActorFollowModel } from '../../../models/activitypub/actor-follow' |
19 | import { JobQueue } from '../../../lib/job-queue' | 19 | import { JobQueue } from '../../../lib/job-queue' |
20 | import { removeRedundancyOf } from '../../../lib/redundancy' | ||
20 | 21 | ||
21 | const serverFollowsRouter = express.Router() | 22 | const serverFollowsRouter = express.Router() |
22 | serverFollowsRouter.get('/following', | 23 | serverFollowsRouter.get('/following', |
@@ -101,6 +102,10 @@ async function removeFollow (req: express.Request, res: express.Response, next: | |||
101 | server.redundancyAllowed = false | 102 | server.redundancyAllowed = false |
102 | await server.save({ transaction: t }) | 103 | await server.save({ transaction: t }) |
103 | 104 | ||
105 | // Async, could be long | ||
106 | removeRedundancyOf(server.id) | ||
107 | .catch(err => logger.error('Cannot remove redundancy of %s.', server.host, err)) | ||
108 | |||
104 | await follow.destroy({ transaction: t }) | 109 | await follow.destroy({ transaction: t }) |
105 | }) | 110 | }) |
106 | 111 | ||
diff --git a/server/controllers/api/server/redundancy.ts b/server/controllers/api/server/redundancy.ts index 4216b9e35..4140c4991 100644 --- a/server/controllers/api/server/redundancy.ts +++ b/server/controllers/api/server/redundancy.ts | |||
@@ -3,6 +3,8 @@ import { UserRight } from '../../../../shared/models/users' | |||
3 | import { asyncMiddleware, authenticate, ensureUserHasRight } from '../../../middlewares' | 3 | import { asyncMiddleware, authenticate, ensureUserHasRight } from '../../../middlewares' |
4 | import { updateServerRedundancyValidator } from '../../../middlewares/validators/redundancy' | 4 | import { updateServerRedundancyValidator } from '../../../middlewares/validators/redundancy' |
5 | import { ServerModel } from '../../../models/server/server' | 5 | import { ServerModel } from '../../../models/server/server' |
6 | import { removeRedundancyOf } from '../../../lib/redundancy' | ||
7 | import { logger } from '../../../helpers/logger' | ||
6 | 8 | ||
7 | const serverRedundancyRouter = express.Router() | 9 | const serverRedundancyRouter = express.Router() |
8 | 10 | ||
@@ -28,5 +30,9 @@ async function updateRedundancy (req: express.Request, res: express.Response, ne | |||
28 | 30 | ||
29 | await server.save() | 31 | await server.save() |
30 | 32 | ||
33 | // Async, could be long | ||
34 | removeRedundancyOf(server.id) | ||
35 | .catch(err => logger.error('Cannot remove redundancy of %s.', server.host, err)) | ||
36 | |||
31 | return res.sendStatus(204) | 37 | return res.sendStatus(204) |
32 | } | 38 | } |