X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/ab4c5a55b8305a125ad8610a55361d976541ec60..eb76e882c5544e319e5084fedcc7cdac0bdf6c2d:/app/Http/Controllers/BookshelfController.php diff --git a/app/Http/Controllers/BookshelfController.php b/app/Http/Controllers/BookshelfController.php index 14bc9d94e..b4795db09 100644 --- a/app/Http/Controllers/BookshelfController.php +++ b/app/Http/Controllers/BookshelfController.php @@ -1,6 +1,7 @@ bookshelfRepo->getBySlug($slug); $this->checkOwnablePermission('book-view', $shelf); - $sort = setting()->getForCurrentUser('shelf_books_sort', 'name'); + $sort = setting()->getForCurrentUser('shelf_books_sort', 'default'); $order = setting()->getForCurrentUser('shelf_books_sort_order', 'asc'); - $visibleShelfBooks = $shelf->visibleBooks()->get(); - $sortedVisibleShelfBooks = $visibleShelfBooks - ->sortBy($sort, SORT_REGULAR, $order === 'desc') + $sortedVisibleShelfBooks = $shelf->visibleBooks()->get() + ->sortBy($sort === 'default' ? 'pivot.order' : $sort, SORT_REGULAR, $order === 'desc') ->values() ->all(); - Views::add($shelf); + View::incrementFor($shelf); $this->entityContextManager->setShelfContext($shelf->id); $view = setting()->getForCurrentUser('bookshelf_view_type');