diff options
author | Maxence Lange <maxence@artificial-owl.com> | 2021-08-10 15:33:42 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-10 15:33:42 +0300 |
commit | 77413a487ed0e046111dfbcf0222650e03a75dd9 (patch) | |
tree | 1fee9c9c6ce5ff943c906c77ac8d5f853931f003 | |
parent | c95441aa773bd3a7cfb60e067b2338eb3ef44d01 (diff) | |
parent | 9b5fd653a2fcc463a2feb527a073df7d9f56761e (diff) |
Merge pull request #650 from nextcloud/backport/647/stable21
[stable21] Fix Navigation
-rw-r--r-- | css/navigate.css | 4 | ||||
-rw-r--r-- | js/navigate.js | 2 | ||||
-rw-r--r-- | lib/Controller/ApiController.php | 13 | ||||
-rw-r--r-- | lib/Service/SearchService.php | 4 |
4 files changed, 16 insertions, 7 deletions
diff --git a/css/navigate.css b/css/navigate.css index e284403..b906169 100644 --- a/css/navigate.css +++ b/css/navigate.css @@ -49,6 +49,10 @@ background-image: url('/apps/fulltextsearch/img/fulltextsearch_black.svg'); } +A.icon-fts { + text-indent: 25px; +} + a.ulsub { padding: 0px 12px 0 12px !important; } diff --git a/js/navigate.js b/js/navigate.js index fa6fc7f..ed3824c 100644 --- a/js/navigate.js +++ b/js/navigate.js @@ -133,7 +133,7 @@ Navigate.prototype = { href: '#', class: (icon !== undefined) ? icon : 'search_icon' }); - aIcon.text(title); + aIcon.addClass('icon-fts').text(title); var ul = $('<ul>'); // if (nav.options !== undefined) { diff --git a/lib/Controller/ApiController.php b/lib/Controller/ApiController.php index 6fd86cf..989a7bf 100644 --- a/lib/Controller/ApiController.php +++ b/lib/Controller/ApiController.php @@ -41,6 +41,7 @@ use OCA\FullTextSearch\Service\SearchService; use OCP\AppFramework\Controller; use OCP\AppFramework\Http\DataResponse; use OCP\IRequest; +use OCP\IUserSession; /** @@ -54,6 +55,9 @@ class ApiController extends Controller { use TNCDataResponse; + /** @var IUserSession */ + private $userSession; + /** @var SearchService */ private $searchService; @@ -68,15 +72,19 @@ class ApiController extends Controller { * NavigationController constructor. * * @param IRequest $request + * @param IUserSession $userSession * @param ConfigService $configService * @param SearchService $searchService * @param MiscService $miscService */ public function __construct( - IRequest $request, ConfigService $configService, SearchService $searchService, + IRequest $request, IUserSession $userSession, ConfigService $configService, + SearchService $searchService, MiscService $miscService ) { parent::__construct(Application::APP_ID, $request); + + $this->userSession = $userSession; $this->searchService = $searchService; $this->configService = $configService; $this->miscService = $miscService; @@ -117,7 +125,8 @@ class ApiController extends Controller { */ private function searchDocuments(SearchRequest $request): DataResponse { try { - $result = $this->searchService->search('', $request); + $user = $this->userSession->getUser(); + $result = $this->searchService->search($user->getUID(), $request); return $this->success( $result, diff --git a/lib/Service/SearchService.php b/lib/Service/SearchService.php index 8cdfe61..f1199a0 100644 --- a/lib/Service/SearchService.php +++ b/lib/Service/SearchService.php @@ -139,10 +139,6 @@ class SearchService implements ISearchService { public function search(string $userId, ISearchRequest $request): array { $this->searchRequestCannotBeEmpty($request); - if ($userId === '') { - $userId = $this->userId; - } - $user = $this->userManager->get($userId); if ($user === null) { throw new NoUserException('User does not exist'); |