X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/ec4cbbd0041122f30d13afc016f8a5fac72e0754..refs/pull/5689/head:/app/Util/SimpleListOptions.php diff --git a/app/Util/SimpleListOptions.php b/app/Util/SimpleListOptions.php index f6daa6954..81d8a5876 100644 --- a/app/Util/SimpleListOptions.php +++ b/app/Util/SimpleListOptions.php @@ -28,13 +28,13 @@ class SimpleListOptions * Create a new instance from the given request. * Takes the item type (plural) that's used as a key for storing sort preferences. */ - public static function fromRequest(Request $request, string $typeKey): self + public static function fromRequest(Request $request, string $typeKey, bool $sortDescDefault = false): self { $search = $request->get('search', ''); $sort = setting()->getForCurrentUser($typeKey . '_sort', ''); - $order = setting()->getForCurrentUser($typeKey . '_sort_order', 'asc'); + $order = setting()->getForCurrentUser($typeKey . '_sort_order', $sortDescDefault ? 'desc' : 'asc'); - return new static($typeKey, $sort, $order, $search); + return new self($typeKey, $sort, $order, $search); } /**