File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3434use OCP \Search \SearchResultEntry ;
3535
3636class 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 }
You can’t perform that action at this time.
0 commit comments