aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/activitypub/process
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-07-26 14:46:15 +0200
committerChocobozzz <me@florianbigard.com>2022-07-27 13:52:13 +0200
commit927fa4b11f692174d6296aa096d7a74bacdeea8b (patch)
tree20866dda219bbb5504d5645a980565fbbc25398a /server/lib/activitypub/process
parent0f58b11f5cace6e57cab5b4a18380eb297b43fe4 (diff)
downloadPeerTube-927fa4b11f692174d6296aa096d7a74bacdeea8b.tar.gz
PeerTube-927fa4b11f692174d6296aa096d7a74bacdeea8b.tar.zst
PeerTube-927fa4b11f692174d6296aa096d7a74bacdeea8b.zip
Add rejected state to follows
Prevent reprocessing already rejected follows
Diffstat (limited to 'server/lib/activitypub/process')
-rw-r--r--server/lib/activitypub/process/process-follow.ts5
-rw-r--r--server/lib/activitypub/process/process-reject.ts3
2 files changed, 7 insertions, 1 deletions
diff --git a/server/lib/activitypub/process/process-follow.ts b/server/lib/activitypub/process/process-follow.ts
index 93df7e191..a1958f464 100644
--- a/server/lib/activitypub/process/process-follow.ts
+++ b/server/lib/activitypub/process/process-follow.ts
@@ -58,6 +58,11 @@ async function processFollow (byActor: MActorSignature, activityId: string, targ
58 transaction: t 58 transaction: t
59 }) 59 })
60 60
61 // Already rejected
62 if (actorFollow.state === 'rejected') {
63 return { actorFollow: undefined as MActorFollowActors }
64 }
65
61 // Set the follow as accepted if the remote actor follows a channel or account 66 // Set the follow as accepted if the remote actor follows a channel or account
62 // Or if the instance automatically accepts followers 67 // Or if the instance automatically accepts followers
63 if (actorFollow.state !== 'accepted' && (isFollowingInstance === false || CONFIG.FOLLOWERS.INSTANCE.MANUAL_APPROVAL === false)) { 68 if (actorFollow.state !== 'accepted' && (isFollowingInstance === false || CONFIG.FOLLOWERS.INSTANCE.MANUAL_APPROVAL === false)) {
diff --git a/server/lib/activitypub/process/process-reject.ts b/server/lib/activitypub/process/process-reject.ts
index 7f7ab305f..db7ff24d8 100644
--- a/server/lib/activitypub/process/process-reject.ts
+++ b/server/lib/activitypub/process/process-reject.ts
@@ -25,7 +25,8 @@ async function processReject (follower: MActor, targetActor: MActor) {
25 25
26 if (!actorFollow) throw new Error(`'Unknown actor follow ${follower.id} -> ${targetActor.id}.`) 26 if (!actorFollow) throw new Error(`'Unknown actor follow ${follower.id} -> ${targetActor.id}.`)
27 27
28 await actorFollow.destroy({ transaction: t }) 28 actorFollow.state = 'rejected'
29 await actorFollow.save({ transaction: t })
29 30
30 return undefined 31 return undefined
31 }) 32 })