summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2019-03-19 19:23:29 +0100
committerGitHub <noreply@github.com>2019-03-19 19:23:29 +0100
commit2fcb6ddc2222aaf48c79cd02ceb0cc78b43c55ab (patch)
tree5141c5d91bd9a2c3a51a6a2144ad366f2c3de802 /lib
parenta5a2c7d81863f3387327016d7138dec049300f61 (diff)
parent21425eb964833f1461ee0bbe678d746e7e24954d (diff)
downloadnextcloud-server-2fcb6ddc2222aaf48c79cd02ceb0cc78b43c55ab.tar.gz
nextcloud-server-2fcb6ddc2222aaf48c79cd02ceb0cc78b43c55ab.zip
Merge pull request #14664 from nextcloud/bugfix/noid/absolute-paths-of-images-for-linked-collaboration-resources
Replace the icon-class with an absolute link to an image
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Collaboration/Resources/Manager.php48
-rw-r--r--lib/private/Collaboration/Resources/Resource.php40
-rw-r--r--lib/public/Collaboration/Resources/IProvider.php24
-rw-r--r--lib/public/Collaboration/Resources/IResource.php16
4 files changed, 17 insertions, 111 deletions
diff --git a/lib/private/Collaboration/Resources/Manager.php b/lib/private/Collaboration/Resources/Manager.php
index dc4d2fc0265..bfe95a74514 100644
--- a/lib/private/Collaboration/Resources/Manager.php
+++ b/lib/private/Collaboration/Resources/Manager.php
@@ -285,41 +285,23 @@ class Manager implements IManager {
}
/**
- * Get the display name of a resource
+ * Get the rich object data of a resource
*
* @param IResource $resource
- * @return string
+ * @return array
* @since 16.0.0
*/
- public function getName(IResource $resource): string {
- foreach ($this->getProviders() as $provider) {
- if ($provider->getType() === $resource->getType()) {
- try {
- return $provider->getName($resource);
- } catch (ResourceException $e) {
- }
- }
- }
-
- return '';
- }
-
- /**
- *
- * @param IResource $resource
- * @return string
- */
- public function getIconClass(IResource $resource): string {
+ public function getResourceRichObject(IResource $resource): array {
foreach ($this->getProviders() as $provider) {
if ($provider->getType() === $resource->getType()) {
try {
- return $provider->getIconClass($resource);
+ return $provider->getResourceRichObject($resource);
} catch (ResourceException $e) {
}
}
}
- return '';
+ return [];
}
/**
@@ -541,24 +523,4 @@ class Manager implements IManager {
public function getType(): string {
return '';
}
-
- /**
- * Get the link to a resource
- *
- * @param IResource $resource
- * @return string
- * @since 16.0.0
- */
- public function getLink(IResource $resource): string {
- foreach ($this->getProviders() as $provider) {
- if ($provider->getType() === $resource->getType()) {
- try {
- return $provider->getLink($resource);
- } catch (ResourceException $e) {
- }
- }
- }
-
- return '';
- }
}
diff --git a/lib/private/Collaboration/Resources/Resource.php b/lib/private/Collaboration/Resources/Resource.php
index d9c72ca2039..038f1d6162d 100644
--- a/lib/private/Collaboration/Resources/Resource.php
+++ b/lib/private/Collaboration/Resources/Resource.php
@@ -49,14 +49,8 @@ class Resource implements IResource {
/** @var bool|null */
protected $access;
- /** @var string|null */
- protected $name;
-
- /** @var string|null */
- protected $iconClass;
-
- /** @var string|null */
- protected $link;
+ /** @var array|null */
+ protected $data;
public function __construct(
IManager $manager,
@@ -91,35 +85,15 @@ class Resource implements IResource {
}
/**
- * @return string
+ * @return array
* @since 16.0.0
*/
- public function getName(): string {
- if ($this->name === null) {
- $this->name = $this->manager->getName($this);
- }
-
- return $this->name;
- }
-
- /**
- * @return string
- * @since 16.0.0
- */
- public function getIconClass(): string {
- if ($this->iconClass === null) {
- $this->iconClass = $this->manager->getIconClass($this);
- }
-
- return $this->iconClass;
- }
-
- public function getLink(): string {
- if ($this->link === null) {
- $this->link = $this->manager->getLink($this);
+ public function getRichObject(): array {
+ if ($this->data === null) {
+ $this->data = $this->manager->getResourceRichObject($this);
}
- return $this->link;
+ return $this->data;
}
/**
diff --git a/lib/public/Collaboration/Resources/IProvider.php b/lib/public/Collaboration/Resources/IProvider.php
index 376a816a5cb..c091ecaa8d5 100644
--- a/lib/public/Collaboration/Resources/IProvider.php
+++ b/lib/public/Collaboration/Resources/IProvider.php
@@ -38,31 +38,13 @@ interface IProvider {
public function getType(): string;
/**
- * Get the display name of a resource
+ * Get the rich object data of a resource
*
* @param IResource $resource
- * @return string
- * @since 16.0.0
- */
- public function getName(IResource $resource): string;
-
- /**
- * Get the icon class of a resource
- *
- * @param IResource $resource
- * @return string
- * @since 16.0.0
- */
- public function getIconClass(IResource $resource): string;
-
- /**
- * Get the link to a resource
- *
- * @param IResource $resource
- * @return string
+ * @return array
* @since 16.0.0
*/
- public function getLink(IResource $resource): string;
+ public function getResourceRichObject(IResource $resource): array;
/**
* Can a user/guest access the collection
diff --git a/lib/public/Collaboration/Resources/IResource.php b/lib/public/Collaboration/Resources/IResource.php
index 609a283c2d8..32567a3be0a 100644
--- a/lib/public/Collaboration/Resources/IResource.php
+++ b/lib/public/Collaboration/Resources/IResource.php
@@ -42,22 +42,10 @@ interface IResource {
public function getId(): string;
/**
- * @return string
- * @since 16.0.0
- */
- public function getName(): string;
-
- /**
- * @return string
- * @since 16.0.0
- */
- public function getIconClass(): string;
-
- /**
- * @return string
+ * @return array
* @since 16.0.0
*/
- public function getLink(): string;
+ public function getRichObject(): array;
/**
* Can a user/guest access the resource