diff options
author | Chocobozzz <me@florianbigard.com> | 2018-07-31 11:15:35 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-07-31 11:15:59 +0200 |
commit | 6104adc3e9d325e003ca1048e8ef35f6a451d0c3 (patch) | |
tree | dd8daa7adc2d11d848512af5708207232885cb0d | |
parent | 25e4d6ee97e9b7a80338cb9c3db5169bf633e32f (diff) | |
download | PeerTube-6104adc3e9d325e003ca1048e8ef35f6a451d0c3.tar.gz PeerTube-6104adc3e9d325e003ca1048e8ef35f6a451d0c3.tar.zst PeerTube-6104adc3e9d325e003ca1048e8ef35f6a451d0c3.zip |
Don't send follow request if the follow is already accepted
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | server/lib/activitypub/actor.ts | 2 | ||||
-rw-r--r-- | server/lib/job-queue/handlers/activitypub-follow.ts | 4 |
3 files changed, 4 insertions, 3 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 8920fbccb..d13c78a4b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md | |||
@@ -32,6 +32,7 @@ You will need [PostgreSQL Contrib](https://www.postgresql.org/docs/9.6/static/co | |||
32 | * Switch job queue to [Bull](https://github.com/OptimalBits/bull). **PeerTube will not migrate your old pending jobs in this new queue manager** | 32 | * Switch job queue to [Bull](https://github.com/OptimalBits/bull). **PeerTube will not migrate your old pending jobs in this new queue manager** |
33 | * Update nginx template (you need to [update manually](https://github.com/Chocobozzz/PeerTube/blob/develop/support/doc/production.md#nginx)) | 33 | * Update nginx template (you need to [update manually](https://github.com/Chocobozzz/PeerTube/blob/develop/support/doc/production.md#nginx)) |
34 | * Update default cache size configurations | 34 | * Update default cache size configurations |
35 | * Update search API route: `/videos/search` becomes `/search/videos` | ||
35 | 36 | ||
36 | ### Features | 37 | ### Features |
37 | 38 | ||
diff --git a/server/lib/activitypub/actor.ts b/server/lib/activitypub/actor.ts index 7f2fc3236..b67d9f08b 100644 --- a/server/lib/activitypub/actor.ts +++ b/server/lib/activitypub/actor.ts | |||
@@ -41,7 +41,7 @@ async function getOrCreateActorAndServerAndModel (activityActor: string | Activi | |||
41 | 41 | ||
42 | let actor = await ActorModel.loadByUrl(actorUrl) | 42 | let actor = await ActorModel.loadByUrl(actorUrl) |
43 | // Orphan actor (not associated to an account of channel) so recreate it | 43 | // Orphan actor (not associated to an account of channel) so recreate it |
44 | if (!actor.Account && !actor.VideoChannel) { | 44 | if (actor && (!actor.Account && !actor.VideoChannel)) { |
45 | await actor.destroy() | 45 | await actor.destroy() |
46 | actor = null | 46 | actor = null |
47 | } | 47 | } |
diff --git a/server/lib/job-queue/handlers/activitypub-follow.ts b/server/lib/job-queue/handlers/activitypub-follow.ts index 2c1b4f49d..393c6936c 100644 --- a/server/lib/job-queue/handlers/activitypub-follow.ts +++ b/server/lib/job-queue/handlers/activitypub-follow.ts | |||
@@ -58,7 +58,7 @@ function follow (fromActor: ActorModel, targetActor: ActorModel) { | |||
58 | actorFollow.ActorFollowing = targetActor | 58 | actorFollow.ActorFollowing = targetActor |
59 | actorFollow.ActorFollower = fromActor | 59 | actorFollow.ActorFollower = fromActor |
60 | 60 | ||
61 | // Send a notification to remote server | 61 | // Send a notification to remote server if our follow is not already accepted |
62 | await sendFollow(actorFollow) | 62 | if (actorFollow.state !== 'accepted') await sendFollow(actorFollow) |
63 | }) | 63 | }) |
64 | } | 64 | } |