summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMarco Nassabain <marco.nassabain@hotmail.com>2021-03-06 22:22:20 +0100
committerSean Molenaar <SMillerDev@users.noreply.github.com>2021-04-08 22:31:21 +0200
commit7f3c63a2a4acea929e70a4136fea5c51e832ec16 (patch)
tree2e9b5b3313428e56e26d53444854ae5f290a3eeb /lib
parent920ae54a2c6d4fa1e1e2612ed7f945a3bf770a18 (diff)
🎨 ShareService: update dummy feed URL
- add IURLGenerator DI - update url to "http://serverurl/news/sharedwithme" - updated tests: added DI + adapted expected url Signed-off-by: Marco Nassabain <marco.nassabain@hotmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/Service/ShareService.php13
1 files changed, 11 insertions, 2 deletions
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;
@@ -46,6 +47,11 @@ class ShareService
protected $logger;
/**
+ * @var IURLGenerator
+ */
+ private $url;
+
+ /**
* @var IL10N
*/
private $l;
@@ -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();