summaryrefslogtreecommitdiffstats
path: root/lib/Service/ItemServiceV2.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Service/ItemServiceV2.php')
-rw-r--r--lib/Service/ItemServiceV2.php15
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/Service/ItemServiceV2.php b/lib/Service/ItemServiceV2.php
index 442fcc1ce..10463b13a 100644
--- a/lib/Service/ItemServiceV2.php
+++ b/lib/Service/ItemServiceV2.php
@@ -460,5 +460,18 @@ class ItemServiceV2 extends Service
return $this->mapper->insert($sharedItem);
}
- // TODO: implement shared() -> return all items shared with user
+ /**
+ * Return all items shared with a given user
+ *
+ * @param string $userId
+ *
+ * @return Item[]
+ */
+ public function sharedWithUser(string $userId): array
+ {
+ return $this->findAllForUser($userId, [
+ 'shared_with' => $userId,
+ 'unread' => true
+ ]);
+ }
}