Skip to content

Commit

Permalink
fix(lookup-server): do not query data by default
Browse files Browse the repository at this point in the history
Signed-off-by: Ferdinand Thiessen <[email protected]>
  • Loading branch information
susnux committed Mar 10, 2025
1 parent f65d1bb commit 98cfdea
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
3 changes: 1 addition & 2 deletions apps/federatedfilesharing/lib/FederatedShareProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -998,8 +998,7 @@ public function isLookupServerQueriesEnabled(): bool {
if ($this->gsConfig->isGlobalScaleEnabled()) {
return true;
}
$result = $this->config->getAppValue('files_sharing', 'lookupServerEnabled', 'yes');
return $result === 'yes';
$result = $this->config->getAppValue('files_sharing', 'lookupServerEnabled', 'no');
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,7 @@ public function testIsLookupServerQueriesEnabled($gsEnabled, $isEnabled, $expect
$this->gsConfig->expects($this->once())->method('isGlobalScaleEnabled')
->willReturn($gsEnabled);
$this->config->expects($this->any())->method('getAppValue')
->with('files_sharing', 'lookupServerEnabled', 'yes')
->with('files_sharing', 'lookupServerEnabled', 'no')
->willReturn($isEnabled);

$this->assertSame($expected,
Expand Down
9 changes: 3 additions & 6 deletions apps/files_sharing/lib/Controller/ShareesAPIController.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,9 @@ public function search(string $search = '', ?string $itemType = null, int $page
$this->offset = $perPage * ($page - 1);

// In global scale mode we always search the loogup server
if ($this->config->getSystemValueBool('gs.enabled', false)) {
$lookup = true;
$this->result['lookupEnabled'] = true;
} else {
$this->result['lookupEnabled'] = $this->config->getAppValue('files_sharing', 'lookupServerEnabled', 'yes') === 'yes';
}
$lookup = $this->config->getSystemValueBool('gs.enabled', false)
|| $this->config->getAppValue('files_sharing', 'lookupServerEnabled', 'no') === 'yes';
$this->result['lookupEnabled'] = $lookup;

[$result, $hasMoreResults] = $this->collaboratorSearch->search($search, $shareTypes, $lookup, $this->limit, $this->offset);

Expand Down
2 changes: 1 addition & 1 deletion lib/private/Collaboration/Collaborators/LookupPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function __construct(

public function search($search, $limit, $offset, ISearchResult $searchResult): bool {
$isGlobalScaleEnabled = $this->config->getSystemValueBool('gs.enabled', false);
$isLookupServerEnabled = $this->config->getAppValue('files_sharing', 'lookupServerEnabled', 'yes') === 'yes';
$isLookupServerEnabled = $this->config->getAppValue('files_sharing', 'lookupServerEnabled', 'no') === 'yes';
$hasInternetConnection = $this->config->getSystemValueBool('has_internet_connection', true);

// if case of Global Scale we always search the lookup server
Expand Down

0 comments on commit 98cfdea

Please sign in to comment.