diff options
author | Maxence Lange <maxence@artificial-owl.com> | 2018-12-04 22:52:47 -0100 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2018-12-05 09:53:23 +0100 |
commit | 6af499a81781a65e6e6f5a20f3e616b8ada480d1 (patch) | |
tree | 8b131c186f2a97b92565dd30e865c495cb21b24a /lib | |
parent | aa3d417edbf05d75248527e4a41c0d25e4ccb70b (diff) |
fill followId and confirm local followers
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Service/ActivityPub/FollowService.php | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/Service/ActivityPub/FollowService.php b/lib/Service/ActivityPub/FollowService.php index 7e1c35f8..e243c271 100644 --- a/lib/Service/ActivityPub/FollowService.php +++ b/lib/Service/ActivityPub/FollowService.php @@ -129,11 +129,14 @@ class FollowService implements ICoreService { $follow->generateUniqueId(); $follow->setActorId($actor->getId()); $follow->setObjectId($remoteActor->getId()); + $follow->setFollowId($remoteActor->getFollowers()); try { $this->followsRequest->getByPersons($actor->getId(), $remoteActor->getId()); } catch (FollowDoesNotExistException $e) { $this->followsRequest->save($follow); + // TODO - Remove this auto-accepted. +// $this->followsRequest->accepted($follow); $follow->addInstancePath( new InstancePath( @@ -258,7 +261,14 @@ class FollowService implements ICoreService { $follow->checkOrigin($follow->getActorId()); try { - $this->followsRequest->getByPersons($follow->getActorId(), $follow->getObjectId()); + $knownFollow = $this->followsRequest->getByPersons( + $follow->getActorId(), $follow->getObjectId() + ); + // in case of local follower. + // TODO - remove when following a local account does not need curl request anymore + if ($knownFollow->getId() === $follow->getId() && !$knownFollow->isAccepted()) { + $this->confirmFollowRequest($follow); + } } catch (FollowDoesNotExistException $e) { $actor = $this->personService->getFromId($follow->getObjectId()); if ($actor->isLocal()) { |