X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/483410749bdfb03d1e3fb98db82c092583a88449..refs/pull/5591/head:/app/Entities/Tools/SiblingFetcher.php diff --git a/app/Entities/Tools/SiblingFetcher.php b/app/Entities/Tools/SiblingFetcher.php index 7b8ac37ad..156209fd2 100644 --- a/app/Entities/Tools/SiblingFetcher.php +++ b/app/Entities/Tools/SiblingFetcher.php @@ -14,6 +14,7 @@ class SiblingFetcher { public function __construct( protected EntityQueries $queries, + protected ShelfContext $shelfContext, ) { } @@ -38,17 +39,17 @@ class SiblingFetcher // Book // Gets just the books in a shelf if shelf is in context if ($entity instanceof Book) { - $contextShelf = (new ShelfContext())->getContextualShelfForBook($entity); + $contextShelf = $this->shelfContext->getContextualShelfForBook($entity); if ($contextShelf) { $entities = $contextShelf->visibleBooks()->get(); } else { - $entities = $this->queries->books->visibleForList()->get(); + $entities = $this->queries->books->visibleForList()->orderBy('name', 'asc')->get(); } } // Shelf if ($entity instanceof Bookshelf) { - $entities = $this->queries->shelves->visibleForList()->get(); + $entities = $this->queries->shelves->visibleForList()->orderBy('name', 'asc')->get(); } return $entities;