Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/fulltextsearch.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxence Lange <maxence@artificial-owl.com>2021-08-10 15:36:20 +0300
committerMaxence Lange <maxence@artificial-owl.com>2021-08-10 15:36:20 +0300
commit281b28396378b8493a74d4483d1d4fe8cf12900b (patch)
treef4cae79dbd8ba321d50131bccbe437437ca345bb
parent770128632ab22e23300169fa26bcd9f0a80c2b50 (diff)
parentb3738c222560cd473f54618329119d667698194e (diff)
Merge remote-tracking branch 'origin/stable21' into stable2121.0.3
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
-rw-r--r--css/navigate.css4
-rw-r--r--js/navigate.js2
-rw-r--r--l10n/fr.js1
-rw-r--r--l10n/fr.json1
-rw-r--r--l10n/hr.js1
-rw-r--r--l10n/hr.json1
-rw-r--r--lib/AppInfo/Application.php7
-rw-r--r--lib/Controller/ApiController.php13
-rw-r--r--lib/Service/SearchService.php4
9 files changed, 24 insertions, 10 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/l10n/fr.js b/l10n/fr.js
index c83f931..0106822 100644
--- a/l10n/fr.js
+++ b/l10n/fr.js
@@ -2,6 +2,7 @@ OC.L10N.register(
"fulltextsearch",
{
"the search returned {total} results in {time} ms" : "la recherche a retourné {total} résultats en {time} ms",
+ "the search in {title} for \"{search}\" returned {total} results in {time} ms" : "La recherche dans {title} pour les mots clés {search} a retourné {total} résultats en {time} ms",
"Search" : "Recherche",
"Index not found" : "Index non trouvé",
"Process timed out" : "Processus expiré",
diff --git a/l10n/fr.json b/l10n/fr.json
index d9346c8..8d24688 100644
--- a/l10n/fr.json
+++ b/l10n/fr.json
@@ -1,5 +1,6 @@
{ "translations": {
"the search returned {total} results in {time} ms" : "la recherche a retourné {total} résultats en {time} ms",
+ "the search in {title} for \"{search}\" returned {total} results in {time} ms" : "La recherche dans {title} pour les mots clés {search} a retourné {total} résultats en {time} ms",
"Search" : "Recherche",
"Index not found" : "Index non trouvé",
"Process timed out" : "Processus expiré",
diff --git a/l10n/hr.js b/l10n/hr.js
index e789d93..e6a8fc4 100644
--- a/l10n/hr.js
+++ b/l10n/hr.js
@@ -2,6 +2,7 @@ OC.L10N.register(
"fulltextsearch",
{
"the search returned {total} results in {time} ms" : "pretraživanjem je pronađeno {total} rezultata za {time} ms",
+ "the search in {title} for \"{search}\" returned {total} results in {time} ms" : "pretraživanjem u {title} za „{search}“ pronađeno je {total} rezultata za {time} ms",
"Search" : "Traži",
"Index not found" : "Indeks nije pronađen",
"Process timed out" : "Isteklo vrijeme postupka",
diff --git a/l10n/hr.json b/l10n/hr.json
index 43ff6a1..c8e11f0 100644
--- a/l10n/hr.json
+++ b/l10n/hr.json
@@ -1,5 +1,6 @@
{ "translations": {
"the search returned {total} results in {time} ms" : "pretraživanjem je pronađeno {total} rezultata za {time} ms",
+ "the search in {title} for \"{search}\" returned {total} results in {time} ms" : "pretraživanjem u {title} za „{search}“ pronađeno je {total} rezultata za {time} ms",
"Search" : "Traži",
"Index not found" : "Indeks nije pronađen",
"Process timed out" : "Isteklo vrijeme postupka",
diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php
index 794ecde..bcbb084 100644
--- a/lib/AppInfo/Application.php
+++ b/lib/AppInfo/Application.php
@@ -48,6 +48,7 @@ use OCP\INavigationManager;
use OCP\IServerContainer;
use OCP\IURLGenerator;
use Symfony\Component\Routing\Exception\RouteNotFoundException;
+use Psr\Container\ContainerInterface;
use Throwable;
require_once __DIR__ . '/../../vendor/autoload.php';
@@ -76,6 +77,7 @@ class Application extends App implements IBootstrap {
public function register(IRegistrationContext $context): void {
$context->registerCapability(Capabilities::class);
$context->registerSearchProvider(UnifiedSearchProvider::class);
+ $this->registerServices($this->getContainer());
}
/**
@@ -84,7 +86,6 @@ class Application extends App implements IBootstrap {
* @throws Throwable
*/
public function boot(IBootContext $context): void {
- $context->injectFn(Closure::fromCallable([$this, 'registerServices']));
$context->injectFn(Closure::fromCallable([$this, 'registerNavigation']));
}
@@ -92,9 +93,9 @@ class Application extends App implements IBootstrap {
/**
* Register Navigation Tab
*
- * @param IServerContainer $container
+ * @param ContainerInterface $container
*/
- protected function registerServices(IServerContainer $container) {
+ protected function registerServices(ContainerInterface $container) {
/** @var IFullTextSearchManager $fullTextSearchManager */
$fullTextSearchManager = $container->get(IFullTextSearchManager::class);
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');