Don't send follow request if the follow is already accepted

This commit is contained in:
Chocobozzz 2018-07-31 11:15:35 +02:00
parent 25e4d6ee97
commit 6104adc3e9
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
3 changed files with 4 additions and 3 deletions

View 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** * 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 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 default cache size configurations
* Update search API route: `/videos/search` becomes `/search/videos`
### Features ### Features

View File

@ -41,7 +41,7 @@ async function getOrCreateActorAndServerAndModel (activityActor: string | Activi
let actor = await ActorModel.loadByUrl(actorUrl) let actor = await ActorModel.loadByUrl(actorUrl)
// Orphan actor (not associated to an account of channel) so recreate it // 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() await actor.destroy()
actor = null actor = null
} }

View File

@ -58,7 +58,7 @@ function follow (fromActor: ActorModel, targetActor: ActorModel) {
actorFollow.ActorFollowing = targetActor actorFollow.ActorFollowing = targetActor
actorFollow.ActorFollower = fromActor actorFollow.ActorFollower = fromActor
// Send a notification to remote server // Send a notification to remote server if our follow is not already accepted
await sendFollow(actorFollow) if (actorFollow.state !== 'accepted') await sendFollow(actorFollow)
}) })
} }