Skip to content

Commit

Permalink
Don't send follow request if the follow is already accepted
Browse files Browse the repository at this point in the history
  • Loading branch information
Chocobozzz committed Jul 31, 2018
1 parent 25e4d6e commit 6104adc
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion server/lib/activitypub/actor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions server/lib/job-queue/handlers/activitypub-follow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
}

0 comments on commit 6104adc

Please sign in to comment.