-
-
Couldn't load subscription status.
- Fork 4.6k
fix(search): Fix SearchComposer.php filtering logic #54120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(search): Fix SearchComposer.php filtering logic #54120
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The filtering should be on array keys instead, no? To be able to select providers, not applications? Otherwise you cannot allow settings_apps but not settings, or the other way around.
Initial idea was to Reduce provider loaded in Unfortunately we destroyed the format of providers from |
fd5bce4 to
6025f5e
Compare
737c2bf to
8b7770c
Compare
1ded41e to
853d3e4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes the filtering logic in SearchComposer.php to properly maintain provider types when filtering based on allowed providers configuration. The key issue was that the original implementation converted an associative array to a numeric array, losing the provider ID keys needed for proper provider access.
Key Changes:
- Modified
filterProviders()method to work in-place on the instance properties rather than returning a filtered array - Updated the filtering logic to preserve associative array structure by using
unset()instead ofarray_filter() - Added comprehensive test coverage for the SearchComposer functionality
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| lib/private/Search/SearchComposer.php | Fixed filtering logic to preserve provider array structure and maintain type consistency |
| tests/lib/Search/SearchComposerTest.php | Added comprehensive test suite covering provider filtering, ordering, and edge cases |
Comments suppressed due to low confidence (1)
tests/lib/Search/SearchComposerTest.php:253
- The test only verifies that the icon contains a specific path pattern but doesn't validate the actual icon generation logic. Consider testing the URL generator mock was called with the correct parameters (appId='app1', imageName='provider1.svg').
$this->assertStringContainsString('/apps/provider1/img/provider1.svg', $providers[0]['icon']);
853d3e4 to
10833ff
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good apart from nitpick in test.
|
see also the code style failure: https://github.com/nextcloud/server/actions/runs/16743727995/job/47397286355?pr=54120 Fix by hand or use |
e33eee5 to
12802c3
Compare
12802c3 to
f09b802
Compare
keep the $this->providers types Test via ./occ config:app:set --value '["files","settings"]' --type array core unified_search.providers_allowed should be part of 8e57004 Signed-off-by: Misha M.-Kupriyanov <kupriyanov@strato.de>
Signed-off-by: Misha M.-Kupriyanov <kupriyanov@strato.de>
Signed-off-by: Misha M.-Kupriyanov <kupriyanov@strato.de>
…e providers Signed-off-by: Misha M.-Kupriyanov <kupriyanov@strato.de>
Signed-off-by: Misha M.-Kupriyanov <kupriyanov@strato.de>
…d providers restriction and empty configuration Signed-off-by: Misha M.-Kupriyanov <kupriyanov@strato.de>
…rder values Signed-off-by: Misha M.-Kupriyanov <kupriyanov@strato.de>
f09b802 to
55f5598
Compare
|
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! (If you believe you should not receive this message, you can add yourself to the blocklist.) |
|
/backport to stable31 |
|
/backport to stable30 |
Summary
keep the $this->providers types
Test via
./occ config:app:set --value '["files","settings"]' --type array core unified_search.providers_allowedshould be part of 8e57004
Tests can be executed via
composer run test -- tests/lib/Search/SearchComposerTest.phpTODO
Checklist