summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--appinfo/routes.php1
-rw-r--r--lib/Controller/ItemController.php20
2 files changed, 21 insertions, 0 deletions
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 [];
+ }
+
}