From 7f3c63a2a4acea929e70a4136fea5c51e832ec16 Mon Sep 17 00:00:00 2001 From: Marco Nassabain Date: Sat, 6 Mar 2021 22:22:20 +0100 Subject: =?UTF-8?q?=F0=9F=8E=A8=20ShareService:=20update=20dummy=20feed=20?= =?UTF-8?q?URL=20-=20add=20IURLGenerator=20DI=20-=20update=20url=20to=20"h?= =?UTF-8?q?ttp://serverurl/news/sharedwithme"=20-=20updated=20tests:=20add?= =?UTF-8?q?ed=20DI=20+=20adapted=20expected=20url?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marco Nassabain --- lib/Service/ShareService.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/Service/ShareService.php b/lib/Service/ShareService.php index ab1183d55..e95fe673b 100644 --- a/lib/Service/ShareService.php +++ b/lib/Service/ShareService.php @@ -14,6 +14,7 @@ use \OCA\News\Db\Item; use \OCA\News\Db\Feed; use \Psr\Log\LoggerInterface; +use OCP\IURLGenerator; use \OCP\IL10N; use OCA\News\Service\Exceptions\ServiceNotFoundException; @@ -45,6 +46,11 @@ class ShareService */ protected $logger; + /** + * @var IURLGenerator + */ + private $url; + /** * @var IL10N */ @@ -55,17 +61,20 @@ class ShareService * * @param FeedServiceV2 $feedService Service for feeds * @param ItemServiceV2 $itemService Service to manage items - * @param IL10N $l Localization interface + * @param IURLGenerator $url URL Generator + * @param IL10N $l Localization interface * @param LoggerInterface $logger Logger */ public function __construct( FeedServiceV2 $feedService, ItemServiceV2 $itemService, + IURLGenerator $url, IL10N $l, LoggerInterface $logger ) { $this->itemService = $itemService; $this->feedService = $feedService; + $this->url = $url; $this->l = $l; $this->logger = $logger; } @@ -98,7 +107,7 @@ class ShareService $sharedItem->setSharedBy($userId); // Get 'shared with me' dummy feed - $feedUrl = 'http://nextcloud/sharedwithme'; + $feedUrl = $this->url->getBaseUrl() . '/news/sharedwithme'; $feed = $this->feedService->findByUrl($shareRecipientId, $feedUrl); if (is_null($feed)) { $feed = new Feed(); -- cgit v1.2.3