summaryrefslogtreecommitdiffstats
path: root/lib/private/Collaboration/Collaborators/RemotePlugin.php
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2017-09-06 16:09:29 +0200
committerArthur Schiwon <blizzz@arthur-schiwon.de>2017-09-26 23:10:23 +0200
commit4a96e222588104f647f911857e370b3ab692ea22 (patch)
treec0859c504c83b8e4e6f11a2d1c39974ca338e63b /lib/private/Collaboration/Collaborators/RemotePlugin.php
parent579c1476a3ec5d9b93130c84a5cc1438b9bd03a9 (diff)
downloadnextcloud-server-4a96e222588104f647f911857e370b3ab692ea22.tar.gz
nextcloud-server-4a96e222588104f647f911857e370b3ab692ea22.zip
don't keep result types hard coded
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'lib/private/Collaboration/Collaborators/RemotePlugin.php')
-rw-r--r--lib/private/Collaboration/Collaborators/RemotePlugin.php8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/private/Collaboration/Collaborators/RemotePlugin.php b/lib/private/Collaboration/Collaborators/RemotePlugin.php
index ff075b8e42d..c97a951be7e 100644
--- a/lib/private/Collaboration/Collaborators/RemotePlugin.php
+++ b/lib/private/Collaboration/Collaborators/RemotePlugin.php
@@ -26,6 +26,7 @@ namespace OC\Collaboration\Collaborators;
use OCP\Collaboration\Collaborators\ISearchPlugin;
use OCP\Collaboration\Collaborators\ISearchResult;
+use OCP\Collaboration\Collaborators\SearchResultType;
use OCP\Contacts\IManager;
use OCP\Federation\ICloudIdManager;
use OCP\IConfig;
@@ -51,6 +52,7 @@ class RemotePlugin implements ISearchPlugin {
public function search($search, $limit, $offset, ISearchResult $searchResult) {
$result = ['wide' => [], 'exact' => []];
+ $resultType = new SearchResultType('remotes');
// Search in contacts
//@todo Pagination missing
@@ -74,7 +76,7 @@ class RemotePlugin implements ISearchPlugin {
if (strtolower($contact['FN']) === $lowerSearch || strtolower($cloudId) === $lowerSearch) {
if (strtolower($cloudId) === $lowerSearch) {
- $searchResult->hasExactIdMatch('remotes');
+ $searchResult->hasExactIdMatch($resultType);
}
$result['exact'][] = [
'label' => $contact['FN'] . " ($cloudId)",
@@ -102,7 +104,7 @@ class RemotePlugin implements ISearchPlugin {
$result['wide'] = [];
}
- if (!$searchResult->hasExactIdMatch('remotes') && $this->cloudIdManager->isValidCloudId($search) && $offset === 0) {
+ if (!$searchResult->hasExactIdMatch($resultType) && $this->cloudIdManager->isValidCloudId($search) && $offset === 0) {
$result['exact'][] = [
'label' => $search,
'value' => [
@@ -112,7 +114,7 @@ class RemotePlugin implements ISearchPlugin {
];
}
- $searchResult->addResultSet('remotes', $result['wide'], $result['exact']);
+ $searchResult->addResultSet($resultType, $result['wide'], $result['exact']);
return false;
}