Dan Brown

Fixed bug which hid entities and fixed new chapter priority

...@@ -59,7 +59,7 @@ class ChapterController extends Controller ...@@ -59,7 +59,7 @@ class ChapterController extends Controller
59 59
60 $input = $request->all(); 60 $input = $request->all();
61 $input['priority'] = $this->bookRepo->getNewPriority($book); 61 $input['priority'] = $this->bookRepo->getNewPriority($book);
62 - $chapter = $this->chapterRepo->createFromInput($request->all(), $book); 62 + $chapter = $this->chapterRepo->createFromInput($input, $book);
63 Activity::add($chapter, 'chapter_create', $book->id); 63 Activity::add($chapter, 'chapter_create', $book->id);
64 return redirect($chapter->getUrl()); 64 return redirect($chapter->getUrl());
65 } 65 }
...@@ -171,6 +171,14 @@ class ChapterController extends Controller ...@@ -171,6 +171,14 @@ class ChapterController extends Controller
171 ]); 171 ]);
172 } 172 }
173 173
174 + /**
175 + * Perform the move action for a chapter.
176 + * @param $bookSlug
177 + * @param $chapterSlug
178 + * @param Request $request
179 + * @return mixed
180 + * @throws \BookStack\Exceptions\NotFoundException
181 + */
174 public function move($bookSlug, $chapterSlug, Request $request) { 182 public function move($bookSlug, $chapterSlug, Request $request) {
175 $book = $this->bookRepo->getBySlug($bookSlug); 183 $book = $this->bookRepo->getBySlug($bookSlug);
176 $chapter = $this->chapterRepo->getBySlug($chapterSlug, $book->id); 184 $chapter = $this->chapterRepo->getBySlug($chapterSlug, $book->id);
......
...@@ -251,7 +251,10 @@ class BookRepo extends EntityRepo ...@@ -251,7 +251,10 @@ class BookRepo extends EntityRepo
251 }]); 251 }]);
252 $chapterQuery = $this->permissionService->enforceChapterRestrictions($chapterQuery, 'view'); 252 $chapterQuery = $this->permissionService->enforceChapterRestrictions($chapterQuery, 'view');
253 $chapters = $chapterQuery->get(); 253 $chapters = $chapterQuery->get();
254 - $children = $pages->merge($chapters); 254 + $children = $pages->values();
255 + foreach ($chapters as $chapter) {
256 + $children->push($chapter);
257 + }
255 $bookSlug = $book->slug; 258 $bookSlug = $book->slug;
256 259
257 $children->each(function ($child) use ($bookSlug) { 260 $children->each(function ($child) use ($bookSlug) {
......