From 565033e0d4d929148db434d42c64bf569e3608de Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Sun, 3 Jul 2016 10:31:20 +0100 Subject: [PATCH] Fixed bug which hid entities and fixed new chapter priority --- app/Http/Controllers/ChapterController.php | 10 +++++++++- app/Repos/BookRepo.php | 5 ++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/ChapterController.php b/app/Http/Controllers/ChapterController.php index a3a939f61..3c9050bf6 100644 --- a/app/Http/Controllers/ChapterController.php +++ b/app/Http/Controllers/ChapterController.php @@ -59,7 +59,7 @@ class ChapterController extends Controller $input = $request->all(); $input['priority'] = $this->bookRepo->getNewPriority($book); - $chapter = $this->chapterRepo->createFromInput($request->all(), $book); + $chapter = $this->chapterRepo->createFromInput($input, $book); Activity::add($chapter, 'chapter_create', $book->id); return redirect($chapter->getUrl()); } @@ -171,6 +171,14 @@ class ChapterController extends Controller ]); } + /** + * Perform the move action for a chapter. + * @param $bookSlug + * @param $chapterSlug + * @param Request $request + * @return mixed + * @throws \BookStack\Exceptions\NotFoundException + */ public function move($bookSlug, $chapterSlug, Request $request) { $book = $this->bookRepo->getBySlug($bookSlug); $chapter = $this->chapterRepo->getBySlug($chapterSlug, $book->id); diff --git a/app/Repos/BookRepo.php b/app/Repos/BookRepo.php index b0530b4f5..a11ed2763 100644 --- a/app/Repos/BookRepo.php +++ b/app/Repos/BookRepo.php @@ -251,7 +251,10 @@ class BookRepo extends EntityRepo }]); $chapterQuery = $this->permissionService->enforceChapterRestrictions($chapterQuery, 'view'); $chapters = $chapterQuery->get(); - $children = $pages->merge($chapters); + $children = $pages->values(); + foreach ($chapters as $chapter) { + $children->push($chapter); + } $bookSlug = $book->slug; $children->each(function ($child) use ($bookSlug) {