Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
namespace OCA\Files_Versions\Listener;

use OC\Files\Node\Folder;
use OCA\Files_Versions\Sabre\Plugin;
use OCA\Files_Versions\Versions\IMetadataVersionBackend;
use OCA\Files_Versions\Versions\IVersionManager;
use OCP\EventDispatcher\Event;
Expand Down Expand Up @@ -48,7 +49,7 @@ public function post_write_hook(Node $node): void {
// check if our version manager supports setting the metadata
if ($this->versionManager instanceof IMetadataVersionBackend) {
$author = $user->getUID();
$this->versionManager->setMetadataValue($node, $node->getMTime(), 'author', $author);
$this->versionManager->setMetadataValue($node, $node->getMTime(), Plugin::AUTHOR, $author);
}
}
}
10 changes: 7 additions & 3 deletions apps/files_versions/lib/Sabre/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
class Plugin extends ServerPlugin {
private Server $server;

public const LABEL = 'label';

public const AUTHOR = 'author';

public const VERSION_LABEL = '{http://nextcloud.org/ns}version-label';

public const VERSION_AUTHOR = '{http://nextcloud.org/ns}version-author'; // dav property for author
Expand Down Expand Up @@ -76,8 +80,8 @@ public function afterGet(RequestInterface $request, ResponseInterface $response)

public function propFind(PropFind $propFind, INode $node): void {
if ($node instanceof VersionFile) {
$propFind->handle(self::VERSION_LABEL, fn () => $node->getMetadataValue('label'));
$propFind->handle(self::VERSION_AUTHOR, fn () => $node->getMetadataValue('author'));
$propFind->handle(self::VERSION_LABEL, fn () => $node->getMetadataValue(self::LABEL));
$propFind->handle(self::VERSION_AUTHOR, fn () => $node->getMetadataValue(self::AUTHOR));
$propFind->handle(FilesPlugin::HAS_PREVIEW_PROPERTYNAME, fn () => $this->previewManager->isMimeSupported($node->getContentType()));
}
}
Expand All @@ -86,7 +90,7 @@ public function propPatch($path, PropPatch $propPatch): void {
$node = $this->server->tree->getNodeForPath($path);

if ($node instanceof VersionFile) {
$propPatch->handle(self::VERSION_LABEL, fn (string $label) => $node->setMetadataValue('label', $label));
$propPatch->handle(self::VERSION_LABEL, fn (string $label) => $node->setMetadataValue(self::LABEL, $label));
}
}
}
Loading