From 2cba1e4146221f28ac195f62fbbb6cd9dbb555fd Mon Sep 17 00:00:00 2001 From: Marco Nassabain Date: Fri, 5 Mar 2021 22:14:56 +0100 Subject: =?UTF-8?q?=F0=9F=A7=B9=20Cleanup=20code,=20remove=20spaces,=20ren?= =?UTF-8?q?ame=20variables?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marco Nassabain --- lib/Controller/ItemController.php | 8 ++++---- lib/Db/Item.php | 1 - lib/Service/ItemServiceV2.php | 1 - lib/Service/ShareService.php | 11 ++++------- 4 files changed, 8 insertions(+), 13 deletions(-) (limited to 'lib') diff --git a/lib/Controller/ItemController.php b/lib/Controller/ItemController.php index ec56a9e33..a437bf3ff 100644 --- a/lib/Controller/ItemController.php +++ b/lib/Controller/ItemController.php @@ -330,16 +330,16 @@ class ItemController extends Controller /** * @NoAdminRequired * - * @param int $itemId Item to share - * @param string $shareWithId User to share with + * @param int $itemId Item to share + * @param string $shareRecipientId User to share the item with */ - public function share($itemId, $shareWithId) + public function share($itemId, $shareRecipientId) { try { $this->shareService->shareItemWithUser( $this->getUserId(), $itemId, - $shareWithId + $shareRecipientId ); } catch (ServiceNotFoundException $ex) { return $this->error($ex, Http::STATUS_NOT_FOUND); diff --git a/lib/Db/Item.php b/lib/Db/Item.php index 730e387d1..411428e96 100644 --- a/lib/Db/Item.php +++ b/lib/Db/Item.php @@ -70,7 +70,6 @@ class Item extends Entity implements IAPI, \JsonSerializable /** @var string */ protected $sharedBy; - public function __construct() { $this->addType('contentHash', 'string'); diff --git a/lib/Service/ItemServiceV2.php b/lib/Service/ItemServiceV2.php index 3b1a81400..57804a8c3 100644 --- a/lib/Service/ItemServiceV2.php +++ b/lib/Service/ItemServiceV2.php @@ -295,7 +295,6 @@ class ItemServiceV2 extends Service return $this->mapper->findAllInFolderAfter($userId, $folderId, $updatedSince, $hideRead); } - /** * Returns all new items of a type * diff --git a/lib/Service/ShareService.php b/lib/Service/ShareService.php index e88675a21..395cd17d8 100644 --- a/lib/Service/ShareService.php +++ b/lib/Service/ShareService.php @@ -73,25 +73,22 @@ class ShareService * The item is then placed in a dummy feed reserved for items * shared with the user * - * @return Item + * @return Item Shared item * @throws ServiceNotFoundException|ServiceConflictException */ public function shareItemWithUser(string $userId, int $itemId, string $shareRecipientId) { - // find item to share + // Find item to share $item = $this->itemService->find($userId, $itemId); - // duplicate the item + // Duplicate item & initialize fields $sharedItem = clone $item; - - // initialize fields $sharedItem->setId(null); $sharedItem->setUnread(true); $sharedItem->setStarred(false); $sharedItem->setSharedBy($userId); - // get 'shared with me' dummy feed - // TODO: move to feedService->createSharedWithMeFeed() ? + // Get 'shared with me' dummy feed $feedUrl = 'http://nextcloud/sharedwithme'; $feed = $this->feedService->findByUrl($shareRecipientId, $feedUrl); if (is_null($feed)) { -- cgit v1.2.3