aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-08-30 16:50:12 +0200
committerChocobozzz <chocobozzz@cpy.re>2019-09-04 16:24:58 +0200
commit8424c4026afd7304880a4ce8138a04ffb3d8c938 (patch)
tree5b42625a59307b03333aa7d293b40b4c90da8f73 /server/controllers
parentf69ec5f340638ef577e8f5b9b1fb844778656a1f (diff)
downloadPeerTube-8424c4026afd7304880a4ce8138a04ffb3d8c938.tar.gz
PeerTube-8424c4026afd7304880a4ce8138a04ffb3d8c938.tar.zst
PeerTube-8424c4026afd7304880a4ce8138a04ffb3d8c938.zip
Add auto follow back support for instances
Diffstat (limited to 'server/controllers')
-rw-r--r--server/controllers/api/config.ts12
-rw-r--r--server/controllers/api/server/follows.ts3
-rw-r--r--server/controllers/api/users/my-notifications.ts3
3 files changed, 17 insertions, 1 deletions
diff --git a/server/controllers/api/config.ts b/server/controllers/api/config.ts
index 21fa85a08..0c52bfa7a 100644
--- a/server/controllers/api/config.ts
+++ b/server/controllers/api/config.ts
@@ -300,6 +300,18 @@ function customConfig (): CustomConfig {
300 enabled: CONFIG.FOLLOWERS.INSTANCE.ENABLED, 300 enabled: CONFIG.FOLLOWERS.INSTANCE.ENABLED,
301 manualApproval: CONFIG.FOLLOWERS.INSTANCE.MANUAL_APPROVAL 301 manualApproval: CONFIG.FOLLOWERS.INSTANCE.MANUAL_APPROVAL
302 } 302 }
303 },
304 followings: {
305 instance: {
306 autoFollowBack: {
307 enabled: CONFIG.FOLLOWINGS.INSTANCE.AUTO_FOLLOW_BACK.ENABLED
308 },
309
310 autoFollowIndex: {
311 enabled: CONFIG.FOLLOWINGS.INSTANCE.AUTO_FOLLOW_INDEX.ENABLED,
312 indexUrl: CONFIG.FOLLOWINGS.INSTANCE.AUTO_FOLLOW_INDEX.INDEX_URL
313 }
314 }
303 } 315 }
304 } 316 }
305} 317}
diff --git a/server/controllers/api/server/follows.ts b/server/controllers/api/server/follows.ts
index d38ce91de..37647622b 100644
--- a/server/controllers/api/server/follows.ts
+++ b/server/controllers/api/server/follows.ts
@@ -25,6 +25,7 @@ import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
25import { JobQueue } from '../../../lib/job-queue' 25import { JobQueue } from '../../../lib/job-queue'
26import { removeRedundancyOf } from '../../../lib/redundancy' 26import { removeRedundancyOf } from '../../../lib/redundancy'
27import { sequelizeTypescript } from '../../../initializers/database' 27import { sequelizeTypescript } from '../../../initializers/database'
28import { autoFollowBackIfNeeded } from '../../../lib/activitypub/follow'
28 29
29const serverFollowsRouter = express.Router() 30const serverFollowsRouter = express.Router()
30serverFollowsRouter.get('/following', 31serverFollowsRouter.get('/following',
@@ -172,5 +173,7 @@ async function acceptFollower (req: express.Request, res: express.Response) {
172 follow.state = 'accepted' 173 follow.state = 'accepted'
173 await follow.save() 174 await follow.save()
174 175
176 await autoFollowBackIfNeeded(follow)
177
175 return res.status(204).end() 178 return res.status(204).end()
176} 179}
diff --git a/server/controllers/api/users/my-notifications.ts b/server/controllers/api/users/my-notifications.ts
index f146284e4..017f5219e 100644
--- a/server/controllers/api/users/my-notifications.ts
+++ b/server/controllers/api/users/my-notifications.ts
@@ -76,7 +76,8 @@ async function updateNotificationSettings (req: express.Request, res: express.Re
76 newFollow: body.newFollow, 76 newFollow: body.newFollow,
77 newUserRegistration: body.newUserRegistration, 77 newUserRegistration: body.newUserRegistration,
78 commentMention: body.commentMention, 78 commentMention: body.commentMention,
79 newInstanceFollower: body.newInstanceFollower 79 newInstanceFollower: body.newInstanceFollower,
80 autoInstanceFollowing: body.autoInstanceFollowing
80 } 81 }
81 82
82 await UserNotificationSettingModel.update(values, query) 83 await UserNotificationSettingModel.update(values, query)