summaryrefslogtreecommitdiffstats
path: root/lib/Controller
diff options
context:
space:
mode:
authorAurélien <dav.aurelien@gmail.com>2021-01-28 13:54:08 +0100
committerSean Molenaar <SMillerDev@users.noreply.github.com>2021-04-08 22:31:21 +0200
commit5f69c256e30bdebf40264166e6dd29f12904e14e (patch)
tree51fa6e29273c83835ab77ace63ba42167e22b5ba /lib/Controller
parentf3c4d744c011df8d18c49495f5111a17197b7038 (diff)
Add function for avoid duplicate item (share)
Signed-off-by: Marco Nassabain <marco.nassabain@hotmail.com>
Diffstat (limited to 'lib/Controller')
-rw-r--r--lib/Controller/ItemController.php8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/Controller/ItemController.php b/lib/Controller/ItemController.php
index b72311416..9c83b4dfc 100644
--- a/lib/Controller/ItemController.php
+++ b/lib/Controller/ItemController.php
@@ -334,12 +334,14 @@ class ItemController extends Controller
public function share($itemId, $shareWithId)
{
try {
- $this->itemService->shareItem($itemId, $shareWithId, $this->userId);
+ $exists = $this->itemService->checkSharing($itemId, $shareWithId, $this->userId);
+
+ if($exists==0){
+ $this->itemService->shareItem($itemId, $shareWithId, $this->userId);
+ }
} catch (ServiceNotFoundException $ex) {
return $this->error($ex, Http::STATUS_NOT_FOUND);
}
-
- return [];
}
}