]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Don't send follow request if the follow is already accepted
authorChocobozzz <me@florianbigard.com>
Tue, 31 Jul 2018 09:15:35 +0000 (11:15 +0200)
committerChocobozzz <me@florianbigard.com>
Tue, 31 Jul 2018 09:15:59 +0000 (11:15 +0200)
CHANGELOG.md
server/lib/activitypub/actor.ts
server/lib/job-queue/handlers/activitypub-follow.ts

index 8920fbccbfe53e1048f91b909a6c413acaf1cbb0..d13c78a4b781fe7959ee0dc998a6f82cb1736c84 100644 (file)
@@ -32,6 +32,7 @@ You will need [PostgreSQL Contrib](https://www.postgresql.org/docs/9.6/static/co
  * Switch job queue to [Bull](https://github.com/OptimalBits/bull). **PeerTube will not migrate your old pending jobs in this new queue manager**
  * Update nginx template (you need to [update manually](https://github.com/Chocobozzz/PeerTube/blob/develop/support/doc/production.md#nginx))
  * Update default cache size configurations
+ * Update search API route: `/videos/search` becomes `/search/videos`
  
 ### Features
 
index 7f2fc32365f7a6a7289888744efae05bbd8ffb00..b67d9f08b6ccd636c4c386eefe5e2b1645035d06 100644 (file)
@@ -41,7 +41,7 @@ async function getOrCreateActorAndServerAndModel (activityActor: string | Activi
 
   let actor = await ActorModel.loadByUrl(actorUrl)
   // Orphan actor (not associated to an account of channel) so recreate it
-  if (!actor.Account && !actor.VideoChannel) {
+  if (actor && (!actor.Account && !actor.VideoChannel)) {
     await actor.destroy()
     actor = null
   }
index 2c1b4f49d960b720c4a9888958e5fbf5585ada8b..393c6936cd7b4b2fa50842d657ae23362f32cbdf 100644 (file)
@@ -58,7 +58,7 @@ function follow (fromActor: ActorModel, targetActor: ActorModel) {
     actorFollow.ActorFollowing = targetActor
     actorFollow.ActorFollower = fromActor
 
-    // Send a notification to remote server
-    await sendFollow(actorFollow)
+    // Send a notification to remote server if our follow is not already accepted
+    if (actorFollow.state !== 'accepted') await sendFollow(actorFollow)
   })
 }