diff options
author | blizzz <blizzz@arthur-schiwon.de> | 2019-12-19 13:00:39 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-19 13:00:39 +0100 |
commit | 5a986f02a33bd1f54fd951af7dc5a1fed02b8340 (patch) | |
tree | 7eb182f219f9ce954872213eb0777c2269d43b6b /apps/workflowengine | |
parent | eaf89d1c69b409a577fe28e82ff5a2ac2f7f9412 (diff) | |
parent | f8394e3551de6993f163fea12019cbbc32fc5167 (diff) | |
download | nextcloud-server-5a986f02a33bd1f54fd951af7dc5a1fed02b8340.tar.gz nextcloud-server-5a986f02a33bd1f54fd951af7dc5a1fed02b8340.zip |
Merge pull request #18162 from nextcloud/enh/noid/url-fileentity
flow file entity to provide the internal URL
Diffstat (limited to 'apps/workflowengine')
-rw-r--r-- | apps/workflowengine/lib/Entity/File.php | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/apps/workflowengine/lib/Entity/File.php b/apps/workflowengine/lib/Entity/File.php index 6196af5bc23..e849ddce7f4 100644 --- a/apps/workflowengine/lib/Entity/File.php +++ b/apps/workflowengine/lib/Entity/File.php @@ -26,6 +26,7 @@ namespace OCA\WorkflowEngine\Entity; use OCP\EventDispatcher\Event; use OCP\EventDispatcher\GenericEvent; +use OCP\Files\InvalidPathException; use OCP\Files\IRootFolder; use OCP\Files\Node; use OCP\Files\NotFoundException; @@ -38,11 +39,12 @@ use OCP\SystemTag\ISystemTag; use OCP\SystemTag\ISystemTagManager; use OCP\SystemTag\MapperEvent; use OCP\WorkflowEngine\EntityContext\IDisplayText; +use OCP\WorkflowEngine\EntityContext\IUrl; use OCP\WorkflowEngine\GenericEntityEvent; use OCP\WorkflowEngine\IEntity; use OCP\WorkflowEngine\IRuleMatcher; -class File implements IEntity, IDisplayText { +class File implements IEntity, IDisplayText, IUrl { private const EVENT_NAMESPACE = '\OCP\Files::'; @@ -208,4 +210,14 @@ class File implements IEntity, IDisplayText { return $this->l10n->t('%s assigned %s to %s', $options); } } + + public function getUrl(): string { + try { + return $this->urlGenerator->linkToRouteAbsolute('files.viewcontroller.showFile', ['fileid' => $this->getNode()->getId()]); + } catch (InvalidPathException $e) { + return ''; + } catch (NotFoundException $e) { + return ''; + } + } } |