Skip to content

Conversation

@printminion-co
Copy link
Contributor

@printminion-co printminion-co commented Jul 28, 2025

Summary

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

Tests can be executed via

 composer run test -- tests/lib/Search/SearchComposerTest.php

TODO

  • ...

Checklist

Copy link
Contributor

@come-nc come-nc left a 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.

@printminion-co
Copy link
Contributor Author

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 loadLazyProviders method build in here https://github.com/nextcloud/server/pull/54120/files#diff-b892980bbda0284c7230f57fd9c5a658b81d5dbfc8cd51fba24be61d4250799bL104-L107

Unfortunately we destroyed the format of providers from array<string, array{appId: string, provider: IProvider}> to be an array. This should fix it.

@printminion-co printminion-co requested a review from Copilot July 29, 2025 09:02

This comment was marked as outdated.

@printminion-co printminion-co force-pushed the fix/unified_search.providers_allowed branch 2 times, most recently from fd5bce4 to 6025f5e Compare July 29, 2025 14:23
@printminion-co printminion-co marked this pull request as draft July 30, 2025 07:58
@printminion-co printminion-co force-pushed the fix/unified_search.providers_allowed branch 2 times, most recently from 737c2bf to 8b7770c Compare July 30, 2025 09:23
@printminion-co printminion-co marked this pull request as ready for review July 30, 2025 09:56

This comment was marked as outdated.

@printminion-co printminion-co force-pushed the fix/unified_search.providers_allowed branch 3 times, most recently from 1ded41e to 853d3e4 Compare July 31, 2025 14:33
@printminion-co printminion-co requested a review from Copilot July 31, 2025 14:35

This comment was marked as outdated.

@printminion-co printminion-co requested a review from Copilot July 31, 2025 14:38
Copy link

Copilot AI left a 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 of array_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']);

@printminion-co printminion-co requested a review from come-nc August 1, 2025 08:05
@printminion-co printminion-co force-pushed the fix/unified_search.providers_allowed branch from 853d3e4 to 10833ff Compare August 5, 2025 07:38
Copy link
Contributor

@come-nc come-nc left a 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.

@come-nc
Copy link
Contributor

come-nc commented Aug 5, 2025

see also the code style failure: https://github.com/nextcloud/server/actions/runs/16743727995/job/47397286355?pr=54120

Fix by hand or use composer run cs:fix.

@printminion-co printminion-co force-pushed the fix/unified_search.providers_allowed branch from e33eee5 to 12802c3 Compare August 5, 2025 09:59
@printminion-co printminion-co force-pushed the fix/unified_search.providers_allowed branch from 12802c3 to f09b802 Compare August 5, 2025 10:11
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>
@printminion-co printminion-co force-pushed the fix/unified_search.providers_allowed branch from f09b802 to 55f5598 Compare August 11, 2025 07:42
@github-actions
Copy link
Contributor

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

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.)

@sorbaugh
Copy link
Contributor

/backport to stable31

@sorbaugh
Copy link
Contributor

/backport to stable30

@sorbaugh sorbaugh merged commit 7fe5c8f into nextcloud:master Aug 14, 2025
192 of 198 checks passed
@skjnldsv skjnldsv mentioned this pull request Aug 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants