mirror of
https://github.com/nextcloud/server.git
synced 2026-02-20 00:12:30 -05:00
fix(files_version): deprecated INameableVersion
Signed-off-by: Eduardo Morales <emoral435@gmail.com>
This commit is contained in:
parent
4cf4fdc278
commit
a8844d408b
8 changed files with 16 additions and 13 deletions
|
|
@ -114,13 +114,14 @@ class Application extends App implements IBootstrap {
|
|||
$context->registerEventListener(NodeTouchedEvent::class, FileEventsListener::class);
|
||||
$context->registerEventListener(BeforeNodeWrittenEvent::class, FileEventsListener::class);
|
||||
$context->registerEventListener(NodeWrittenEvent::class, FileEventsListener::class);
|
||||
$context->registerEventListener(NodeWrittenEvent::class, MetadataFileEvents::class);
|
||||
$context->registerEventListener(BeforeNodeDeletedEvent::class, FileEventsListener::class);
|
||||
$context->registerEventListener(NodeDeletedEvent::class, FileEventsListener::class);
|
||||
$context->registerEventListener(NodeRenamedEvent::class, FileEventsListener::class);
|
||||
$context->registerEventListener(NodeCopiedEvent::class, FileEventsListener::class);
|
||||
$context->registerEventListener(BeforeNodeRenamedEvent::class, FileEventsListener::class);
|
||||
$context->registerEventListener(BeforeNodeCopiedEvent::class, FileEventsListener::class);
|
||||
|
||||
$context->registerEventListener(NodeWrittenEvent::class, MetadataFileEvents::class);
|
||||
}
|
||||
|
||||
public function boot(IBootContext $context): void {
|
||||
|
|
|
|||
|
|
@ -84,8 +84,8 @@ class VersionEntity extends Entity implements JsonSerializable {
|
|||
* if nothing is found, we return an empty string
|
||||
* @param string $key key associated with the value
|
||||
*/
|
||||
public function getMetadataValue(string $key): string {
|
||||
return $this->metadata[$key] ?? '';
|
||||
public function getMetadataValue(string $key): ?string {
|
||||
return $this->metadata[$key] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ class Plugin extends ServerPlugin {
|
|||
public function propFind(PropFind $propFind, INode $node): void {
|
||||
if ($node instanceof VersionFile) {
|
||||
$propFind->handle(self::VERSION_LABEL, fn () => $node->getLabel());
|
||||
$propFind->handle(self::VERSION_AUTHOR, fn () => $node->getMetadataAuthor());
|
||||
$propFind->handle(self::VERSION_AUTHOR, fn () => $node->getMetadataValue("author"));
|
||||
$propFind->handle(FilesPlugin::HAS_PREVIEW_PROPERTYNAME, fn () => $this->previewManager->isMimeSupported($node->getContentType()));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -110,11 +110,11 @@ class VersionFile implements IFile {
|
|||
}
|
||||
}
|
||||
|
||||
public function getMetadataAuthor(): string {
|
||||
public function getMetadataValue(string $key): ?string {
|
||||
if ($this->version instanceof IMetadataVersion) {
|
||||
return $this->version->getMetadataValue("author");
|
||||
return $this->version->getMetadataValue($key);
|
||||
}
|
||||
return '';
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getLastModified(): int {
|
||||
|
|
|
|||
|
|
@ -34,5 +34,5 @@ interface IMetadataVersion {
|
|||
* @param string $key the key for the json value of the metadata column
|
||||
* @since 29.0.0
|
||||
*/
|
||||
public function getMetadataValue(string $key): string;
|
||||
public function getMetadataValue(string $key): ?string;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,12 +24,13 @@ declare(strict_types=1);
|
|||
namespace OCA\Files_Versions\Versions;
|
||||
|
||||
/**
|
||||
* @deprecated 29.0.0
|
||||
* @since 26.0.0
|
||||
*/
|
||||
interface INameableVersion {
|
||||
/**
|
||||
* Get the user created label
|
||||
*
|
||||
* @deprecated 29.0.0
|
||||
* @return string
|
||||
* @since 26.0.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -24,12 +24,13 @@ declare(strict_types=1);
|
|||
namespace OCA\Files_Versions\Versions;
|
||||
|
||||
/**
|
||||
* @deprecated 29.0.0
|
||||
* @since 26.0.0
|
||||
*/
|
||||
interface INameableVersionBackend {
|
||||
/**
|
||||
* Set the label for a version.
|
||||
*
|
||||
* @deprecated 29.0.0
|
||||
* @since 26.0.0
|
||||
*/
|
||||
public function setVersionLabel(IVersion $version, string $label): void;
|
||||
|
|
|
|||
|
|
@ -123,10 +123,10 @@ class Version implements IVersion, INameableVersion, IMetadataVersion {
|
|||
return $this->user;
|
||||
}
|
||||
|
||||
public function getMetadataValue(string $key): string {
|
||||
public function getMetadataValue(string $key): ?string {
|
||||
if ($this->backend instanceof IMetadataVersionBackend && $this->sourceFileInfo instanceof Node) {
|
||||
return $this->backend->getMetadataValue($this->sourceFileInfo, "author") ?? '';
|
||||
return $this->backend->getMetadataValue($this->sourceFileInfo, "author");
|
||||
}
|
||||
return '';
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue