Skip to content

Firefly III: a personal finances manager

Updated Transaction Search API to set limit from user preferences

johnny30ff2f0f11ac
diff --git a/app/Api/V1/Controllers/Search/TransactionController.php b/app/Api/V1/Controllers/Search/TransactionController.php
index 58766005b7..b320ea5e45 100644
--- a/app/Api/V1/Controllers/Search/TransactionController.php
+++ b/app/Api/V1/Controllers/Search/TransactionController.php
@@ -48,10 +48,10 @@ class TransactionController extends Controller
$manager = $this->getManager();
$fullQuery = (string) $request->get('query');
$page = 0 === (int) $request->get('page') ? 1 : (int) $request->get('page');
-
+ $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
$searcher->parseQuery($fullQuery);
$searcher->setPage($page);
- $searcher->setLimit((int) config('firefly.search_result_limit'));
+ $searcher->setLimit($pageSize);
$groups = $searcher->searchTransactions();
$parameters = ['search' => $fullQuery];
$url = route('api.v1.search.transactions') . '?' . http_build_query($parameters);