Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 5.1k
Add in:users as a search filter to limit searches to users#40413
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
ab81cd165c70d7c38bafba3a5998f66e4eebdf0fe6d6e21c3File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| <?php | ||
| declare(strict_types=1); | ||
| /** | ||
| * @copyright Copyright (c) 2023 Stephan Orbaugh <stephan.orbaugh@nextcloud.com> | ||
| * | ||
| * @author Stephan Orbaugh <stephan.orbaugh@nextcloud.com> | ||
| * | ||
| * | ||
| * @license GNU AGPL version 3 or any later version | ||
| * | ||
| * This program is free software: you can redistribute it and/or modify | ||
| * it under the terms of the GNU Affero General Public License as | ||
| * published by the Free Software Foundation, either version 3 of the | ||
| * License, or (at your option) any later version. | ||
| * | ||
| * This program is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU Affero General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Affero General Public License | ||
| * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| * | ||
| */ | ||
| namespace OCA\Settings\Search; | ||
| use OCP\IL10N; | ||
| use OCP\IUser; | ||
| use OCP\Search\IProvider; | ||
| use OCP\Search\ISearchQuery; | ||
| use OCP\Search\SearchResult; | ||
| class UserSearch implements IProvider { | ||
| /** @var IL10N */ | ||
| protected $l; | ||
| public function __construct( | ||
| IL10N $l) { | ||
| $this->l = $l; | ||
| } | ||
| /** | ||
| * @inheritDoc | ||
| */ | ||
| public function getId(): string { | ||
| return 'users'; | ||
| } | ||
| /** | ||
| * @inheritDoc | ||
| */ | ||
| public function getName(): string { | ||
| return $this->l->t('Users'); | ||
| } | ||
| /** | ||
| * @inheritDoc | ||
| */ | ||
| public function getOrder(string $route, array $routeParameters): int { | ||
| return 300; | ||
| } | ||
| /** | ||
| * @inheritDoc | ||
| */ | ||
| public function search(IUser $user, ISearchQuery $query): SearchResult { | ||
| return SearchResult::complete( | ||
| $this->l->t('Users'), | ||
| [] | ||
| ); | ||
| } | ||
| } | ||
Large diffs are not rendered by default.
Uh oh!
There was an error while loading. Please reload this page.
Large diffs are not rendered by default.
Uh oh!
There was an error while loading. Please reload this page.
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.
Do I understand how it works correctly, that this search plugin intentionally returns an empty result set? For users page it make sense as results are shown on the content and not in the pull down. Maybe I am misinterpreting how that search works though.
The naming would block potential valid future searches for users, although there is the contacts menu for this. It's acceptable, but want to point it out.
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.
Yes I agree this is somewhat strange. ATM the main goal is for a customer to more efficiently search for contacts without triggering everything. You correctly pointed out that the goal is to not have a list of users shown in the pulldown. See commit where how this used to be solved (and how we want to revisit in the future)
54a21d4