aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2023-09-27 16:38:21 +0200
committerJoas Schilling <coding@schilljs.com>2023-09-28 14:02:18 +0200
commita7018bc5e8f50f3242f3658c2442baa0dd4d1c65 (patch)
treee80c789c39cdac6f5c917e01ae0246d0ac924caf
parent1a1514e29655e10b056cee79129b819fb1ebeeeb (diff)
downloadnextcloud-server-a7018bc5e8f50f3242f3658c2442baa0dd4d1c65.tar.gz
nextcloud-server-a7018bc5e8f50f3242f3658c2442baa0dd4d1c65.zip
fix(autocomplete): Fix missing user status on autocomplete endpoint
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r--build/integration/collaboration_features/autocomplete.feature9
-rw-r--r--build/integration/config/behat.yml4
-rw-r--r--build/integration/features/bootstrap/CollaborationContext.php3
-rw-r--r--core/Controller/AutoCompleteController.php4
-rw-r--r--core/ResponseDefinitions.php7
-rw-r--r--core/openapi.json33
6 files changed, 52 insertions, 8 deletions
diff --git a/build/integration/collaboration_features/autocomplete.feature b/build/integration/collaboration_features/autocomplete.feature
index df7b81b9148..7329db79e29 100644
--- a/build/integration/collaboration_features/autocomplete.feature
+++ b/build/integration/collaboration_features/autocomplete.feature
@@ -15,12 +15,13 @@ Feature: autocomplete
| auto | users |
| autocomplete | users |
| autocomplete2 | users |
+ And user "autocomplete" has status "dnd"
When parameter "shareapi_restrict_user_enumeration_full_match" of app "core" is set to "no"
Then get autocomplete for "auto"
- | id | source |
- | auto | users |
- | autocomplete | users |
- | autocomplete2 | users |
+ | id | source | status |
+ | auto | users | "" |
+ | autocomplete | users | {"status":"dnd","message":null,"icon":null,"clearAt":null} |
+ | autocomplete2 | users | "" |
Scenario: getting autocomplete without enumeration
diff --git a/build/integration/config/behat.yml b/build/integration/config/behat.yml
index 0e577f5925e..fdd9f890b0e 100644
--- a/build/integration/config/behat.yml
+++ b/build/integration/config/behat.yml
@@ -1,6 +1,10 @@
default:
autoload:
'': "%paths.base%/../features/bootstrap"
+ formatters:
+ pretty:
+ output_styles:
+ comment: [ 'bright-blue' ]
suites:
default:
paths:
diff --git a/build/integration/features/bootstrap/CollaborationContext.php b/build/integration/features/bootstrap/CollaborationContext.php
index adfc357b0e1..00fcbd09b26 100644
--- a/build/integration/features/bootstrap/CollaborationContext.php
+++ b/build/integration/features/bootstrap/CollaborationContext.php
@@ -73,6 +73,9 @@ class CollaborationContext implements Context {
if (isset($expected['source'])) {
$data['source'] = $suggestion['source'];
}
+ if (isset($expected['status'])) {
+ $data['status'] = json_encode($suggestion['status']);
+ }
return $data;
}, $suggestions, $formData->getHash()));
}
diff --git a/core/Controller/AutoCompleteController.php b/core/Controller/AutoCompleteController.php
index fd7f9188f96..0b692d85277 100644
--- a/core/Controller/AutoCompleteController.php
+++ b/core/Controller/AutoCompleteController.php
@@ -123,8 +123,8 @@ class AutoCompleteController extends OCSController {
/** @var ?string $subline */
$subline = array_key_exists('subline', $result) ? $result['subline'] : null;
- /** @var ?string $status */
- $status = array_key_exists('status', $result) && is_string($result['status']) ? $result['status'] : null;
+ /** @var ?array{status: string, message: ?string, icon: ?string, clearAt: ?int} $status */
+ $status = array_key_exists('status', $result) && is_array($result['status']) && !empty($result['status']) ? $result['status'] : null;
/** @var ?string $shareWithDisplayNameUnique */
$shareWithDisplayNameUnique = array_key_exists('shareWithDisplayNameUnique', $result) ? $result['shareWithDisplayNameUnique'] : null;
diff --git a/core/ResponseDefinitions.php b/core/ResponseDefinitions.php
index 1e5d97b6267..7e2bc643ce5 100644
--- a/core/ResponseDefinitions.php
+++ b/core/ResponseDefinitions.php
@@ -124,7 +124,12 @@ namespace OCA\Core;
* label: string,
* icon: string,
* source: string,
- * status: string,
+ * status: array{
+ * status: string,
+ * message: ?string,
+ * icon: ?string,
+ * clearAt: ?int,
+ * }|string,
* subline: string,
* shareWithDisplayNameUnique: string,
* }
diff --git a/core/openapi.json b/core/openapi.json
index 4d2b2f5a369..a9c810a790a 100644
--- a/core/openapi.json
+++ b/core/openapi.json
@@ -45,7 +45,38 @@
"type": "string"
},
"status": {
- "type": "string"
+ "oneOf": [
+ {
+ "type": "object",
+ "required": [
+ "status",
+ "message",
+ "icon",
+ "clearAt"
+ ],
+ "properties": {
+ "status": {
+ "type": "string"
+ },
+ "message": {
+ "type": "string",
+ "nullable": true
+ },
+ "icon": {
+ "type": "string",
+ "nullable": true
+ },
+ "clearAt": {
+ "type": "integer",
+ "format": "int64",
+ "nullable": true
+ }
+ }
+ },
+ {
+ "type": "string"
+ }
+ ]
},
"subline": {
"type": "string"