aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--server/lib/activitypub/process/process-follow.ts10
-rw-r--r--server/tests/api/moderation/blocklist-notification.ts2
2 files changed, 6 insertions, 6 deletions
diff --git a/server/lib/activitypub/process/process-follow.ts b/server/lib/activitypub/process/process-follow.ts
index e633cd3ae..da660bda3 100644
--- a/server/lib/activitypub/process/process-follow.ts
+++ b/server/lib/activitypub/process/process-follow.ts
@@ -40,7 +40,7 @@ async function processFollow (byActor: MActorSignature, activityId: string, targ
40 if (!targetActor) throw new Error('Unknown actor') 40 if (!targetActor) throw new Error('Unknown actor')
41 if (targetActor.isOwned() === false) throw new Error('This is not a local actor.') 41 if (targetActor.isOwned() === false) throw new Error('This is not a local actor.')
42 42
43 if (rejectIfInstanceFollowDisabled(byActor, activityId, targetActor)) return { actorFollow: undefined } 43 if (await rejectIfInstanceFollowDisabled(byActor, activityId, targetActor)) return { actorFollow: undefined }
44 if (await rejectIfMuted(byActor, activityId, targetActor)) return { actorFollow: undefined } 44 if (await rejectIfMuted(byActor, activityId, targetActor)) return { actorFollow: undefined }
45 45
46 const [ actorFollow, created ] = await ActorFollowModel.findOrCreateCustom({ 46 const [ actorFollow, created ] = await ActorFollowModel.findOrCreateCustom({
@@ -79,7 +79,7 @@ async function processFollow (byActor: MActorSignature, activityId: string, targ
79 const follower = await ActorModel.loadFull(byActor.id) 79 const follower = await ActorModel.loadFull(byActor.id)
80 const actorFollowFull = Object.assign(actorFollow, { ActorFollowing: targetActor, ActorFollower: follower }) 80 const actorFollowFull = Object.assign(actorFollow, { ActorFollowing: targetActor, ActorFollower: follower })
81 81
82 if (isFollowingInstance(targetActor)) { 82 if (await isFollowingInstance(targetActor)) {
83 Notifier.Instance.notifyOfNewInstanceFollow(actorFollowFull) 83 Notifier.Instance.notifyOfNewInstanceFollow(actorFollowFull)
84 } else { 84 } else {
85 Notifier.Instance.notifyOfNewUserFollow(actorFollowFull) 85 Notifier.Instance.notifyOfNewUserFollow(actorFollowFull)
@@ -89,8 +89,8 @@ async function processFollow (byActor: MActorSignature, activityId: string, targ
89 logger.info('Actor %s is followed by actor %s.', targetActorURL, byActor.url) 89 logger.info('Actor %s is followed by actor %s.', targetActorURL, byActor.url)
90} 90}
91 91
92function rejectIfInstanceFollowDisabled (byActor: MActorSignature, activityId: string, targetActor: MActorFull) { 92async function rejectIfInstanceFollowDisabled (byActor: MActorSignature, activityId: string, targetActor: MActorFull) {
93 if (isFollowingInstance(targetActor) && CONFIG.FOLLOWERS.INSTANCE.ENABLED === false) { 93 if (await isFollowingInstance(targetActor) && CONFIG.FOLLOWERS.INSTANCE.ENABLED === false) {
94 logger.info('Rejecting %s because instance followers are disabled.', targetActor.url) 94 logger.info('Rejecting %s because instance followers are disabled.', targetActor.url)
95 95
96 sendReject(activityId, byActor, targetActor) 96 sendReject(activityId, byActor, targetActor)
@@ -133,7 +133,7 @@ async function acceptIfNeeded (actorFollow: MActorFollow, targetActor: MActorFul
133 // Set the follow as accepted if the remote actor follows a channel or account 133 // Set the follow as accepted if the remote actor follows a channel or account
134 // Or if the instance automatically accepts followers 134 // Or if the instance automatically accepts followers
135 if (actorFollow.state === 'accepted') return 135 if (actorFollow.state === 'accepted') return
136 if (!isFollowingInstance(targetActor)) return 136 if (!await isFollowingInstance(targetActor)) return
137 if (CONFIG.FOLLOWERS.INSTANCE.MANUAL_APPROVAL === true) return 137 if (CONFIG.FOLLOWERS.INSTANCE.MANUAL_APPROVAL === true) return
138 138
139 actorFollow.state = 'accepted' 139 actorFollow.state = 'accepted'
diff --git a/server/tests/api/moderation/blocklist-notification.ts b/server/tests/api/moderation/blocklist-notification.ts
index 87d147998..265477f57 100644
--- a/server/tests/api/moderation/blocklist-notification.ts
+++ b/server/tests/api/moderation/blocklist-notification.ts
@@ -23,7 +23,7 @@ async function checkNotifications (server: PeerTubeServer, token: string, expect
23 } 23 }
24} 24}
25 25
26describe('Test blocklist', function () { 26describe('Test blocklist notifications', function () {
27 let servers: PeerTubeServer[] 27 let servers: PeerTubeServer[]
28 let videoUUID: string 28 let videoUUID: string
29 29