From 08171bb42de718cda797462b9f5de029ce82afb9 Mon Sep 17 00:00:00 2001 From: Marco Nassabain Date: Sun, 17 Jan 2021 19:51:17 +0100 Subject: =?UTF-8?q?=E2=9C=A8=20NewsItem:=20add=20share=20routes=20+=20cont?= =?UTF-8?q?roller=20func?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marco Nassabain --- appinfo/routes.php | 1 + lib/Controller/ItemController.php | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/appinfo/routes.php b/appinfo/routes.php index a50f4a5b7..534f37540 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -52,6 +52,7 @@ return ['routes' => [ ['name' => 'item#read', 'url' => '/items/{itemId}/read', 'verb' => 'POST'], ['name' => 'item#read_multiple', 'url' => '/items/read/multiple', 'verb' => 'POST'], ['name' => 'item#star', 'url' => '/items/{feedId}/{guidHash}/star', 'verb' => 'POST'], +['name' => 'item#share', 'url' => '/items/{itemId}/share/{shareWithId}', 'verb' => 'POST'], // export ['name' => 'export#opml', 'url' => '/export/opml', 'verb' => 'GET'], diff --git a/lib/Controller/ItemController.php b/lib/Controller/ItemController.php index 85f67ef7a..57ad318d2 100644 --- a/lib/Controller/ItemController.php +++ b/lib/Controller/ItemController.php @@ -318,4 +318,24 @@ class ItemController extends Controller } } } + + + /** + * @NoAdminRequired + * + * @param int $itemId + * @param string $shareWithId + * @return array + */ + public function share($itemId, $shareWithId) + { + try { + $this->itemService->shareItem($itemId, $shareWithId, $this->userId); + } catch (ServiceNotFoundException $ex) { + return $this->error($ex, Http::STATUS_NOT_FOUND); + } + + return []; + } + } -- cgit v1.2.3