diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2018-09-25 10:49:23 +0200 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2020-04-28 10:13:57 +0200 |
commit | e70e383378fc38f8154d482a247a0d2ca23a4925 (patch) | |
tree | cf7ee1ee907c1ce2bf6375af4db6f24c311f385a | |
parent | eb7b632ee6f898dbe5c861623f59fa62fc4d5235 (diff) | |
download | wallabag-e70e383378fc38f8154d482a247a0d2ca23a4925.tar.gz wallabag-e70e383378fc38f8154d482a247a0d2ca23a4925.tar.zst wallabag-e70e383378fc38f8154d482a247a0d2ca23a4925.zip |
Avoid overiding default values for sort
-rw-r--r-- | src/Wallabag/CoreBundle/Controller/EntryController.php | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index 5407d065..b3ec7729 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php | |||
@@ -532,9 +532,11 @@ class EntryController extends Controller | |||
532 | $searchTerm = (isset($request->get('search_entry')['term']) ? $request->get('search_entry')['term'] : ''); | 532 | $searchTerm = (isset($request->get('search_entry')['term']) ? $request->get('search_entry')['term'] : ''); |
533 | $currentRoute = (null !== $request->query->get('currentRoute') ? $request->query->get('currentRoute') : ''); | 533 | $currentRoute = (null !== $request->query->get('currentRoute') ? $request->query->get('currentRoute') : ''); |
534 | 534 | ||
535 | $sortBy = 'createdAt'; | 535 | // defined as null by default because each repository method have the right field as default value too |
536 | if (in_array($request->get('sort', 'createdAt'), ['id', 'createdAt', 'title', 'updatedAt'], true)) { | 536 | // like `getBuilderForStarredByUser` will have `starredAt` sort by default |
537 | $sortBy = $request->get('sort', 'createdAt'); | 537 | $sortBy = null; |
538 | if (in_array($request->get('sort', 'createdAt'), ['id', 'title', 'createdAt', 'updatedAt', 'starredAt', 'archivedAt'], true)) { | ||
539 | $sortBy = $request->get('sort', null); | ||
538 | } | 540 | } |
539 | 541 | ||
540 | $direction = 'DESC' === $request->get('direction') ? 'DESC' : 'ASC'; | 542 | $direction = 'DESC' === $request->get('direction') ? 'DESC' : 'ASC'; |