Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/private/Collaboration/Collaborators/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use OCP\Collaboration\Collaborators\ISearchResult;
use OCP\Collaboration\Collaborators\SearchResultType;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\IConfig;
use OCP\IContainer;
use OCP\Share\IShare;

Expand All @@ -23,6 +24,7 @@ class Search implements ISearch {
public function __construct(
private readonly IContainer $container,
private readonly IEventDispatcher $eventDispatcher,
private readonly IConfig $config,
) {
}

Expand All @@ -41,6 +43,9 @@ public function filteredSearch(string $search, array $shareTypes, bool $lookup,

$searchResult = new SearchResult();

// confirm lookup server is not empty
$lookup = $lookup && !empty($this->config->getSystemValueString('lookup_server', 'https://lookup.nextcloud.com'));

foreach ($shareTypes as $type) {
if (!isset($this->pluginList[$type])) {
continue;
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -981,7 +981,7 @@ public function __construct(
$this->registerAlias(\OCP\Share\IManager::class, \OC\Share20\Manager::class);

$this->registerService(ISearch::class, static function (Server $c): ISearch {
$instance = new Search($c, $c->get(IEventDispatcher::class));
$instance = new Search($c, $c->get(IEventDispatcher::class), $c->get(IConfig::class));

// register default plugins
$instance->registerPlugin(['shareType' => IShare::TYPE_USER, 'class' => UserPlugin::class]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use OCP\Collaboration\Collaborators\ISearch;
use OCP\Collaboration\Collaborators\SearchResultType;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\IConfig;
use OCP\IContainer;
use Test\TestCase;

Expand All @@ -27,7 +28,7 @@ protected function setUp(): void {

$this->container = $this->createMock(IContainer::class);

$this->search = new Search($this->container, $this->createMock(IEventDispatcher::class));
$this->search = new Search($this->container, $this->createMock(IEventDispatcher::class), $this->createMock(IConfig::class));
}

public static function dataAddResultSet(): array {
Expand Down
6 changes: 4 additions & 2 deletions tests/lib/Collaboration/Collaborators/SearchTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use OCP\Collaboration\Collaborators\ISearchResult;
use OCP\Collaboration\Collaborators\SearchResultType;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\IConfig;
use OCP\IContainer;
use OCP\Share\IShare;
use PHPUnit\Framework\MockObject\MockObject;
Expand All @@ -23,6 +24,7 @@
class SearchTest extends TestCase {
protected IContainer&MockObject $container;
protected IEventDispatcher&MockObject $eventDispatcher;
protected IConfig&MockObject $config;
protected Search $search;

#[\Override]
Expand All @@ -31,8 +33,8 @@ protected function setUp(): void {

$this->container = $this->createMock(IContainer::class);
$this->eventDispatcher = $this->createMock(IEventDispatcher::class);

$this->search = new Search($this->container, $this->eventDispatcher);
$this->config = $this->createMock(IConfig::class);
$this->search = new Search($this->container, $this->eventDispatcher, $this->config);
}

#[\PHPUnit\Framework\Attributes\DataProvider('dataSearchSharees')]
Expand Down
Loading