diff options
author | Stephan Orbaugh <62374139+sorbaugh@users.noreply.github.com> | 2025-07-07 12:32:41 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-07-07 12:32:41 +0200 |
commit | 9a2cc58d4febdc65b39274c14746a63fde8ee0d8 (patch) | |
tree | 52e38a1355a23f594719f02deda925725a202632 | |
parent | 4dcb282a473b48a59439c61f16d17748b3107805 (diff) | |
parent | 676fb4014d6b7676d26de5c68f77207120445f18 (diff) | |
download | nextcloud-server-9a2cc58d4febdc65b39274c14746a63fde8ee0d8.tar.gz nextcloud-server-9a2cc58d4febdc65b39274c14746a63fde8ee0d8.zip |
Merge pull request #53832 from bdovaz/use-constants
chore: use constants for metadata
-rw-r--r-- | apps/files_versions/lib/Listener/VersionAuthorListener.php | 3 | ||||
-rw-r--r-- | apps/files_versions/lib/Sabre/Plugin.php | 10 |
2 files changed, 9 insertions, 4 deletions
diff --git a/apps/files_versions/lib/Listener/VersionAuthorListener.php b/apps/files_versions/lib/Listener/VersionAuthorListener.php index 6f4e6c0ee57..b76fc7110f7 100644 --- a/apps/files_versions/lib/Listener/VersionAuthorListener.php +++ b/apps/files_versions/lib/Listener/VersionAuthorListener.php @@ -9,6 +9,7 @@ declare(strict_types=1); 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; @@ -48,7 +49,7 @@ class VersionAuthorListener implements IEventListener { // 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); } } } diff --git a/apps/files_versions/lib/Sabre/Plugin.php b/apps/files_versions/lib/Sabre/Plugin.php index 10a1896773d..4b4cb0638bf 100644 --- a/apps/files_versions/lib/Sabre/Plugin.php +++ b/apps/files_versions/lib/Sabre/Plugin.php @@ -24,6 +24,10 @@ use Sabre\HTTP\ResponseInterface; 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 @@ -76,8 +80,8 @@ class Plugin extends ServerPlugin { 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())); } } @@ -86,7 +90,7 @@ class Plugin extends ServerPlugin { $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)); } } } |