From 47c658c32b712277f9330801085c4dd288dbe742 Mon Sep 17 00:00:00 2001
From: Maxence Lange <maxence@artificial-owl.com>
Date: Mon, 17 Dec 2018 09:54:28 -0100
Subject: [PATCH] bring back the request on new follow

Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
---
 lib/Service/FollowService.php | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/lib/Service/FollowService.php b/lib/Service/FollowService.php
index 852c3374..e67a703b 100644
--- a/lib/Service/FollowService.php
+++ b/lib/Service/FollowService.php
@@ -36,6 +36,7 @@ use OCA\Social\Db\FollowsRequest;
 use OCA\Social\Exceptions\CacheActorDoesNotExistException;
 use OCA\Social\Exceptions\FollowDoesNotExistException;
 use OCA\Social\Exceptions\FollowSameAccountException;
+use OCA\Social\Exceptions\InvalidOriginException;
 use OCA\Social\Exceptions\InvalidResourceException;
 use OCA\Social\Exceptions\RedundancyLimitException;
 use OCA\Social\Exceptions\Request410Exception;
@@ -71,6 +72,9 @@ class FollowService {
 	/** @var FollowsRequest */
 	private $followsRequest;
 
+	/** @var ActivityService */
+	private $activityService;
+
 	/** @var CacheActorService */
 	private $cacheActorService;
 
@@ -89,15 +93,18 @@ class FollowService {
 	 * FollowService constructor.
 	 *
 	 * @param FollowsRequest $followsRequest
+	 * @param ActivityService $activityService
 	 * @param CacheActorService $cacheActorService
 	 * @param ConfigService $configService
 	 * @param MiscService $miscService
 	 */
 	public function __construct(
-		FollowsRequest $followsRequest, CacheActorService $cacheActorService,
+		FollowsRequest $followsRequest, ActivityService $activityService,
+		CacheActorService $cacheActorService,
 		ConfigService $configService, MiscService $miscService
 	) {
 		$this->followsRequest = $followsRequest;
+		$this->activityService = $activityService;
 		$this->cacheActorService = $cacheActorService;
 		$this->configService = $configService;
 		$this->miscService = $miscService;
@@ -133,6 +140,8 @@ class FollowService {
 	 * @throws SocialAppConfigException
 	 * @throws UrlCloudException
 	 * @throws UnknownItemException
+	 * @throws InvalidOriginException
+	 * @throws \Exception
 	 */
 	public function followAccount(Person $actor, string $account) {
 		$remoteActor = $this->cacheActorService->getFromAccount($account);
@@ -159,7 +168,7 @@ class FollowService {
 					$remoteActor->getInbox(), InstancePath::TYPE_INBOX, InstancePath::PRIORITY_TOP
 				)
 			);
-//			$this->activityService->request($follow);
+			$this->activityService->request($follow);
 		}
 	}