diff options
Diffstat (limited to 'server/lib/activitypub')
-rw-r--r-- | server/lib/activitypub/process/process-follow.ts | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/server/lib/activitypub/process/process-follow.ts b/server/lib/activitypub/process/process-follow.ts index cecf09b47..140bbe9f1 100644 --- a/server/lib/activitypub/process/process-follow.ts +++ b/server/lib/activitypub/process/process-follow.ts | |||
@@ -32,6 +32,8 @@ async function processFollow (actor: ActorModel, targetActorURL: string) { | |||
32 | 32 | ||
33 | const serverActor = await getServerActor() | 33 | const serverActor = await getServerActor() |
34 | if (targetActor.id === serverActor.id && CONFIG.FOLLOWERS.INSTANCE.ENABLED === false) { | 34 | if (targetActor.id === serverActor.id && CONFIG.FOLLOWERS.INSTANCE.ENABLED === false) { |
35 | logger.info('Rejecting %s because instance followers are disabled.', targetActor.url) | ||
36 | |||
35 | return sendReject(actor, targetActor) | 37 | return sendReject(actor, targetActor) |
36 | } | 38 | } |
37 | 39 | ||
@@ -43,7 +45,7 @@ async function processFollow (actor: ActorModel, targetActorURL: string) { | |||
43 | defaults: { | 45 | defaults: { |
44 | actorId: actor.id, | 46 | actorId: actor.id, |
45 | targetActorId: targetActor.id, | 47 | targetActorId: targetActor.id, |
46 | state: 'accepted' | 48 | state: CONFIG.FOLLOWERS.INSTANCE.MANUAL_APPROVAL ? 'pending' : 'accepted' |
47 | }, | 49 | }, |
48 | transaction: t | 50 | transaction: t |
49 | }) | 51 | }) |
@@ -51,7 +53,7 @@ async function processFollow (actor: ActorModel, targetActorURL: string) { | |||
51 | actorFollow.ActorFollower = actor | 53 | actorFollow.ActorFollower = actor |
52 | actorFollow.ActorFollowing = targetActor | 54 | actorFollow.ActorFollowing = targetActor |
53 | 55 | ||
54 | if (actorFollow.state !== 'accepted') { | 56 | if (actorFollow.state !== 'accepted' && CONFIG.FOLLOWERS.INSTANCE.MANUAL_APPROVAL === false) { |
55 | actorFollow.state = 'accepted' | 57 | actorFollow.state = 'accepted' |
56 | await actorFollow.save({ transaction: t }) | 58 | await actorFollow.save({ transaction: t }) |
57 | } | 59 | } |
@@ -60,7 +62,7 @@ async function processFollow (actor: ActorModel, targetActorURL: string) { | |||
60 | actorFollow.ActorFollowing = targetActor | 62 | actorFollow.ActorFollowing = targetActor |
61 | 63 | ||
62 | // Target sends to actor he accepted the follow request | 64 | // Target sends to actor he accepted the follow request |
63 | await sendAccept(actorFollow) | 65 | if (actorFollow.state === 'accepted') await sendAccept(actorFollow) |
64 | 66 | ||
65 | return { actorFollow, created } | 67 | return { actorFollow, created } |
66 | }) | 68 | }) |