From e82c6c0a3bfdb55da221719abf1a287b5bcdbdbc Mon Sep 17 00:00:00 2001 From: lazerg Date: Sat, 21 Nov 2026 09:44:43 +0500 Subject: [PATCH] fix(sharing): only use lookup for recipient search on GlobalScale Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: lazerg --- .../Recipient/AShareRecipientTypeSearchCollaborator.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/unstable/Sharing/Recipient/AShareRecipientTypeSearchCollaborator.php b/lib/unstable/Sharing/Recipient/AShareRecipientTypeSearchCollaborator.php index 9fde391787aa5..2bf10430e721b 100644 --- a/lib/unstable/Sharing/Recipient/AShareRecipientTypeSearchCollaborator.php +++ b/lib/unstable/Sharing/Recipient/AShareRecipientTypeSearchCollaborator.php @@ -12,6 +12,7 @@ use NCU\Sharing\ShareAccessContext; use OCP\AppFramework\Attribute\Implementable; use OCP\Collaboration\Collaborators\ISearch; +use OCP\GlobalScale\IConfig as IGlobalScaleConfig; use OCP\IUser; use OCP\IUserSession; use OCP\Server; @@ -27,6 +28,8 @@ abstract class AShareRecipientTypeSearchCollaborator implements IShareRecipientT private ?ISearch $search = null; + private ?IGlobalScaleConfig $globalScaleConfig = null; + private function getUserSession(): IUserSession { return $this->userSession ??= Server::get(IUserSession::class); } @@ -35,6 +38,10 @@ private function getSearch(): ISearch { return $this->search ??= Server::get(ISearch::class); } + private function getGlobalScaleConfig(): IGlobalScaleConfig { + return $this->globalScaleConfig ??= Server::get(IGlobalScaleConfig::class); + } + /** * @return list * @experimental 35.0.0 @@ -73,7 +80,7 @@ public function searchRecipients(ShareAccessContext $accessContext, string $quer } // TODO: Maybe merge search requests from different recipient types backed by the collaborators API. - [$searchResults] = $this->getSearch()->filteredSearch($query, $this->getCollaboratorTypes(), true, 'unified-sharing', null, $limit, $offset); + [$searchResults] = $this->getSearch()->filteredSearch($query, $this->getCollaboratorTypes(), $this->getGlobalScaleConfig()->isGlobalScaleEnabled(), 'unified-sharing', null, $limit, $offset); $results = []; if (($exactResults = $searchResults['exact']) !== null) {