summaryrefslogtreecommitdiffstats
path: root/apps/dav/lib
diff options
context:
space:
mode:
Diffstat (limited to 'apps/dav/lib')
-rw-r--r--apps/dav/lib/Connector/Sabre/Node.php26
1 files changed, 11 insertions, 15 deletions
diff --git a/apps/dav/lib/Connector/Sabre/Node.php b/apps/dav/lib/Connector/Sabre/Node.php
index 5fb811ad1ab..1e32e74c325 100644
--- a/apps/dav/lib/Connector/Sabre/Node.php
+++ b/apps/dav/lib/Connector/Sabre/Node.php
@@ -355,23 +355,19 @@ abstract class Node implements \Sabre\DAV\INode {
return '';
}
- $types = [
- IShare::TYPE_USER,
- IShare::TYPE_GROUP,
- IShare::TYPE_CIRCLE,
- IShare::TYPE_ROOM
- ];
-
- foreach ($types as $shareType) {
- $shares = $this->shareManager->getSharedWith($user, $shareType, $this, -1);
- foreach ($shares as $share) {
- $note = $share->getNote();
- if ($share->getShareOwner() !== $user && !empty($note)) {
- return $note;
- }
- }
+ // Retrieve note from the share object already loaded into
+ // memory, to avoid additional database queries.
+ $storage = $this->getNode()->getStorage();
+ if (!$storage->instanceOfStorage(\OCA\Files_Sharing\SharedStorage::class)) {
+ return '';
}
+ /** @var \OCA\Files_Sharing\SharedStorage $storage */
+ $share = $storage->getShare();
+ $note = $share->getNote();
+ if ($share->getShareOwner() !== $user) {
+ return $note;
+ }
return '';
}