summaryrefslogtreecommitdiffstats
path: root/lib/Sabre/Album/PropFindPlugin.php
diff options
context:
space:
mode:
authorLouis Chemineau <louis@chmn.me>2022-09-21 16:50:28 +0200
committerLouis Chemineau <louis@chmn.me>2022-10-10 12:23:52 +0200
commitff01726c6b1a735aace5e88da8387b2e11e4b6f8 (patch)
tree7d62311c54127e2676b1d8cb65f9ae79830ed606 /lib/Sabre/Album/PropFindPlugin.php
parentd8ab1a24d1a4268189ce0e0dfd3f48d84973acf5 (diff)
Add public link logic
Signed-off-by: Louis Chemineau <louis@chmn.me>
Diffstat (limited to 'lib/Sabre/Album/PropFindPlugin.php')
-rw-r--r--lib/Sabre/Album/PropFindPlugin.php24
1 files changed, 11 insertions, 13 deletions
diff --git a/lib/Sabre/Album/PropFindPlugin.php b/lib/Sabre/Album/PropFindPlugin.php
index 46d1c225..00fb8017 100644
--- a/lib/Sabre/Album/PropFindPlugin.php
+++ b/lib/Sabre/Album/PropFindPlugin.php
@@ -78,7 +78,7 @@ class PropFindPlugin extends ServerPlugin {
public function propFind(PropFind $propFind, INode $node): void {
if ($node instanceof AlbumPhoto) {
- // Checking if the node is trulely available and ignoring if not
+ // Checking if the node is truly available and ignoring if not
// Should be pre-emptively handled by the NodeDeletedEvent
try {
$fileInfo = $node->getFileInfo();
@@ -87,12 +87,10 @@ class PropFindPlugin extends ServerPlugin {
}
$propFind->handle(FilesPlugin::INTERNAL_FILEID_PROPERTYNAME, fn () => $node->getFile()->getFileId());
- $propFind->handle(FilesPlugin::GETETAG_PROPERTYNAME, fn () => $node->getETag());
- $propFind->handle(self::FILE_NAME_PROPERTYNAME, fn () => $node->getFile()->getName());
- $propFind->handle(self::FAVORITE_PROPERTYNAME, fn () => $node->isFavorite() ? 1 : 0);
- $propFind->handle(FilesPlugin::HAS_PREVIEW_PROPERTYNAME, function () use ($fileInfo) {
- return json_encode($this->previewManager->isAvailable($fileInfo));
- });
+ $propFind->handle(FilesPlugin::GETETAG_PROPERTYNAME, fn () => $node->getETag());
+ $propFind->handle(self::FILE_NAME_PROPERTYNAME, fn () => $node->getFile()->getName());
+ $propFind->handle(self::FAVORITE_PROPERTYNAME, fn () => $node->isFavorite() ? 1 : 0);
+ $propFind->handle(FilesPlugin::HAS_PREVIEW_PROPERTYNAME, fn () => json_encode($this->previewManager->isAvailable($fileInfo)));
if ($this->metadataEnabled) {
$propFind->handle(FilesPlugin::FILE_METADATA_SIZE, function () use ($node) {
@@ -111,11 +109,11 @@ class PropFindPlugin extends ServerPlugin {
}
}
- if ($node instanceof AlbumRoot || $node instanceof SharedAlbumRoot) {
- $propFind->handle(self::LAST_PHOTO_PROPERTYNAME, fn () => $node->getAlbum()->getAlbum()->getLastAddedPhoto());
- $propFind->handle(self::NBITEMS_PROPERTYNAME, fn () => count($node->getChildren()));
- $propFind->handle(self::LOCATION_PROPERTYNAME, fn () => $node->getAlbum()->getAlbum()->getLocation());
- $propFind->handle(self::DATE_RANGE_PROPERTYNAME, fn () => json_encode($node->getDateRange()));
+ if ($node instanceof AlbumRoot) {
+ $propFind->handle(self::LAST_PHOTO_PROPERTYNAME, fn () => $node->getAlbum()->getAlbum()->getLastAddedPhoto());
+ $propFind->handle(self::NBITEMS_PROPERTYNAME, fn () => count($node->getChildren()));
+ $propFind->handle(self::LOCATION_PROPERTYNAME, fn () => $node->getAlbum()->getAlbum()->getLocation());
+ $propFind->handle(self::DATE_RANGE_PROPERTYNAME, fn () => json_encode($node->getDateRange()));
$propFind->handle(self::COLLABORATORS_PROPERTYNAME, fn () => $node->getCollaborators());
// TODO detect dynamically which metadata groups are requested and
@@ -141,7 +139,7 @@ class PropFindPlugin extends ServerPlugin {
return true;
});
$propPatch->handle(self::COLLABORATORS_PROPERTYNAME, function ($collaborators) use ($node) {
- $this->albumMapper->setCollaborators($node->getAlbum()->getAlbum()->getId(), json_decode($collaborators, true));
+ $collaborators = $node->setCollaborators(json_decode($collaborators, true));
return true;
});
}