]> BookStack Code Mirror - bookstack/commitdiff
Fixed bug which hid entities and fixed new chapter priority
authorDan Brown <redacted>
Sun, 3 Jul 2016 09:31:20 +0000 (10:31 +0100)
committerDan Brown <redacted>
Sun, 3 Jul 2016 09:31:20 +0000 (10:31 +0100)
app/Http/Controllers/ChapterController.php
app/Repos/BookRepo.php

index a3a939f617bc0218b1563e0220b77dd53bddbab1..3c9050bf6b4b705aeb371a09b8273ed9ea581245 100644 (file)
@@ -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);
index b0530b4f5ebe99e9fd017704293b7898f2c8a6e1..a11ed2763c9ce51ad7efc23d1678e1f06eeb9af1 100644 (file)
@@ -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) {