Skip to content

Commit 68e6481

Browse files
committed
Fix application search provider order
Signed-off-by: Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com>
1 parent c89016d commit 68e6481

1 file changed

Lines changed: 11 additions & 26 deletions

File tree

apps/settings/lib/Search/AppSearch.php

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -34,51 +34,36 @@
3434
use OCP\Search\SearchResultEntry;
3535

3636
class AppSearch implements IProvider {
37-
38-
/** @var INavigationManager */
39-
protected $navigationManager;
40-
41-
/** @var IL10N */
42-
protected $l;
43-
44-
public function __construct(INavigationManager $navigationManager,
45-
IL10N $l) {
46-
$this->navigationManager = $navigationManager;
47-
$this->l = $l;
37+
public function __construct(
38+
protected INavigationManager $navigationManager,
39+
protected IL10N $l,
40+
) {
4841
}
4942

50-
/**
51-
* @inheritDoc
52-
*/
5343
public function getId(): string {
5444
return 'settings_apps';
5545
}
5646

57-
/**
58-
* @inheritDoc
59-
*/
6047
public function getName(): string {
6148
return $this->l->t('Apps');
6249
}
6350

64-
/**
65-
* @inheritDoc
66-
*/
6751
public function getOrder(string $route, array $routeParameters): int {
68-
return -50;
52+
return $route === 'settings.AppSettings.viewApps' ? -50 : 100;
6953
}
7054

71-
/**
72-
* @inheritDoc
73-
*/
7455
public function search(IUser $user, ISearchQuery $query): SearchResult {
7556
$entries = $this->navigationManager->getAll('all');
7657

7758
$result = [];
59+
$term = $query->getFilter('term')?->get();
60+
if (empty($term)) {
61+
return $result;
62+
}
7863
foreach ($entries as $entry) {
7964
if (
80-
stripos($entry['name'], $query->getTerm()) === false &&
81-
stripos($entry['id'], $query->getTerm()) === false
65+
stripos($entry['name'], $term) === false &&
66+
stripos($entry['id'], $term) === false
8267
) {
8368
continue;
8469
}

0 commit comments

Comments
 (0)