diff options
author | Joas Schilling <coding@schilljs.com> | 2022-05-03 07:20:46 +0200 |
---|---|---|
committer | backportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com> | 2022-05-05 07:25:54 +0000 |
commit | 48c6b73f2d86fcdaf9c58d3814f3332747499cc8 (patch) | |
tree | 349a476e7b5bb51a3e43170be10832f2ba20d423 | |
parent | e295f5a4a2dda1c0053ef8353775ffb5105e4255 (diff) | |
download | nextcloud-server-48c6b73f2d86fcdaf9c58d3814f3332747499cc8.tar.gz nextcloud-server-48c6b73f2d86fcdaf9c58d3814f3332747499cc8.zip |
Expose shareWithDisplayNameUnique also on autocomplete endpoint
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r-- | core/Controller/AutoCompleteController.php | 1 | ||||
-rw-r--r-- | tests/Core/Controller/AutoCompleteControllerTest.php | 39 |
2 files changed, 31 insertions, 9 deletions
diff --git a/core/Controller/AutoCompleteController.php b/core/Controller/AutoCompleteController.php index 6cbca91ec0f..9f0e43dedd6 100644 --- a/core/Controller/AutoCompleteController.php +++ b/core/Controller/AutoCompleteController.php @@ -118,6 +118,7 @@ class AutoCompleteController extends Controller { 'source' => $type, 'status' => $result['status'] ?? '', 'subline' => $result['subline'] ?? '', + 'shareWithDisplayNameUnique' => $result['shareWithDisplayNameUnique'] ?? '', ]; } } diff --git a/tests/Core/Controller/AutoCompleteControllerTest.php b/tests/Core/Controller/AutoCompleteControllerTest.php index 61fc90e3c82..0775fbbd818 100644 --- a/tests/Core/Controller/AutoCompleteControllerTest.php +++ b/tests/Core/Controller/AutoCompleteControllerTest.php @@ -75,8 +75,8 @@ class AutoCompleteControllerTest extends TestCase { ], // expected [ - [ 'id' => 'alice', 'label' => 'Alice A.', 'icon' => '', 'source' => 'users', 'status' => '', 'subline' => ''], - [ 'id' => 'bob', 'label' => 'Bob Y.', 'icon' => '', 'source' => 'users', 'status' => '', 'subline' => ''], + [ 'id' => 'alice', 'label' => 'Alice A.', 'icon' => '', 'source' => 'users', 'status' => '', 'subline' => '', 'shareWithDisplayNameUnique' => ''], + [ 'id' => 'bob', 'label' => 'Bob Y.', 'icon' => '', 'source' => 'users', 'status' => '', 'subline' => '', 'shareWithDisplayNameUnique' => ''], ], '', 'files', @@ -96,8 +96,8 @@ class AutoCompleteControllerTest extends TestCase { ], // expected [ - [ 'id' => 'alice', 'label' => 'Alice A.', 'icon' => '', 'source' => 'users', 'status' => '', 'subline' => ''], - [ 'id' => 'bob', 'label' => 'Bob Y.', 'icon' => '', 'source' => 'users', 'status' => '', 'subline' => ''], + [ 'id' => 'alice', 'label' => 'Alice A.', 'icon' => '', 'source' => 'users', 'status' => '', 'subline' => '', 'shareWithDisplayNameUnique' => ''], + [ 'id' => 'bob', 'label' => 'Bob Y.', 'icon' => '', 'source' => 'users', 'status' => '', 'subline' => '', 'shareWithDisplayNameUnique' => ''], ], '', null, @@ -117,8 +117,8 @@ class AutoCompleteControllerTest extends TestCase { ], // expected [ - [ 'id' => 'alice', 'label' => 'Alice A.', 'icon' => '', 'source' => 'users', 'status' => '', 'subline' => ''], - [ 'id' => 'bob', 'label' => 'Bob Y.', 'icon' => '', 'source' => 'users', 'status' => '', 'subline' => ''], + [ 'id' => 'alice', 'label' => 'Alice A.', 'icon' => '', 'source' => 'users', 'status' => '', 'subline' => '', 'shareWithDisplayNameUnique' => ''], + [ 'id' => 'bob', 'label' => 'Bob Y.', 'icon' => '', 'source' => 'users', 'status' => '', 'subline' => '', 'shareWithDisplayNameUnique' => ''], ], '', 'files', @@ -138,14 +138,35 @@ class AutoCompleteControllerTest extends TestCase { ], ], [ - [ 'id' => 'bob', 'label' => 'Bob Y.', 'icon' => '', 'source' => 'users', 'status' => '', 'subline' => ''], - [ 'id' => 'bobby', 'label' => 'Robert R.', 'icon' => '', 'source' => 'users', 'status' => '', 'subline' => ''], + [ 'id' => 'bob', 'label' => 'Bob Y.', 'icon' => '', 'source' => 'users', 'status' => '', 'subline' => '', 'shareWithDisplayNameUnique' => ''], + [ 'id' => 'bobby', 'label' => 'Robert R.', 'icon' => '', 'source' => 'users', 'status' => '', 'subline' => '', 'shareWithDisplayNameUnique' => ''], ], 'bob', 'files', '42', null - ] + ], + [ #4 – with unique name + [ + 'exact' => [ + 'users' => [], + 'robots' => [], + ], + 'users' => [ + ['label' => 'Alice A.', 'value' => ['shareWith' => 'alice'], 'shareWithDisplayNameUnique' => 'alica@nextcloud.com'], + ['label' => 'Alice A.', 'value' => ['shareWith' => 'alicea'], 'shareWithDisplayNameUnique' => 'alicaa@nextcloud.com'], + ], + ], + // expected + [ + [ 'id' => 'alice', 'label' => 'Alice A.', 'icon' => '', 'source' => 'users', 'status' => '', 'subline' => '', 'shareWithDisplayNameUnique' => 'alica@nextcloud.com'], + [ 'id' => 'alicea', 'label' => 'Alice A.', 'icon' => '', 'source' => 'users', 'status' => '', 'subline' => '', 'shareWithDisplayNameUnique' => 'alicaa@nextcloud.com'], + ], + '', + 'files', + '42', + 'karma|bus-factor' + ], ]; } |