Skip to content

Commit cdd0e4d

Browse files
authored
Merge pull request #18347 from nextcloud/backport/18144/stable16
[stable16] ShareeAPI GS fixes
2 parents 8af38e7 + f3d9c1f commit cdd0e4d

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

apps/files_sharing/lib/Capabilities.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,11 @@ public function getCapabilities() {
9898
'expire_date' => ['enabled' => true]
9999
];
100100

101+
// Sharee searches
102+
$res['sharee'] = [
103+
'query_lookup_default' => $this->config->getSystemValueBool('gs.enabled', false)
104+
];
105+
101106
return [
102107
'files_sharing' => $res,
103108
];

apps/files_sharing/lib/Controller/ShareesAPIController.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,14 +206,21 @@ public function search(string $search = '', string $itemType = null, int $page =
206206
$this->limit = (int) $perPage;
207207
$this->offset = $perPage * ($page - 1);
208208

209+
// In global scale mode we always search the loogup server
210+
if ($this->config->getSystemValueBool('gs.enabled', false)) {
211+
$lookup = true;
212+
$this->result['lookupEnabled'] = true;
213+
} else {
214+
$this->result['lookupEnabled'] = $this->config->getAppValue('files_sharing', 'lookupServerEnabled', 'yes') === 'yes';
215+
}
216+
209217
list($result, $hasMoreResults) = $this->collaboratorSearch->search($search, $shareTypes, $lookup, $this->limit, $this->offset);
210218

211219
// extra treatment for 'exact' subarray, with a single merge expected keys might be lost
212220
if(isset($result['exact'])) {
213221
$result['exact'] = array_merge($this->result['exact'], $result['exact']);
214222
}
215223
$this->result = array_merge($this->result, $result);
216-
$this->result['lookupEnabled'] = $this->config->getAppValue('files_sharing', 'lookupServerEnabled', 'yes') === 'yes';
217224
$response = new DataResponse($this->result);
218225

219226
if ($hasMoreResults) {

core/js/sharedialogview.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,14 @@
145145
var deferred = $.Deferred();
146146
var view = this;
147147

148+
// query lookup GS by default if enabled
149+
var capabilities = OC.getCapabilities()
150+
if (capabilities.files_sharing
151+
&& capabilities.files_sharing.sharee
152+
&& capabilities.files_sharing.sharee.query_lookup_default) {
153+
this._lookup = true;
154+
}
155+
148156
$.get(
149157
OC.linkToOCS('apps/files_sharing/api/v1') + 'sharees',
150158
{

0 commit comments

Comments
 (0)