]> BookStack Code Mirror - bookstack/blobdiff - app/Http/Controllers/BookshelfController.php
added missing comma that caused the testprocess to fail.
[bookstack] / app / Http / Controllers / BookshelfController.php
index 5c9da762fb3499341c4be851bacc455cd13dad2c..f2cc11c7ba16126eb6f7fef610c8662525d190bf 100644 (file)
@@ -85,12 +85,12 @@ class BookshelfController extends Controller
         $this->validate($request, [
             'name' => 'required|string|max:255',
             'description' => 'string|max:1000',
-            'image' => $this->getImageValidationRules(),
+            'image' => 'nullable|' . $this->getImageValidationRules(),
         ]);
 
         $bookIds = explode(',', $request->get('books', ''));
         $shelf = $this->bookshelfRepo->create($request->all(), $bookIds);
-        $this->bookshelfRepo->updateCoverImage($shelf);
+        $this->bookshelfRepo->updateCoverImage($shelf, $request->file('image', null));
 
         Activity::add($shelf, 'bookshelf_create');
         return redirect($shelf->getUrl());
@@ -103,11 +103,11 @@ class BookshelfController extends Controller
     public function show(string $slug)
     {
         $shelf = $this->bookshelfRepo->getBySlug($slug);
-        $view = setting()->getForCurrentUser('books_view_type', config('app.views.books'));
         $this->checkOwnablePermission('book-view', $shelf);
 
         Views::add($shelf);
         $this->entityContextManager->setShelfContext($shelf->id);
+        $view = setting()->getForCurrentUser('bookshelf_view_type', config('app.views.books'));
 
         $this->setPageTitle($shelf->getShortName());
         return view('shelves.show', [
@@ -148,7 +148,7 @@ class BookshelfController extends Controller
         $this->validate($request, [
             'name' => 'required|string|max:255',
             'description' => 'string|max:1000',
-            'image' => $this->imageRepo->getImageValidationRules(),
+            'image' => 'nullable|' . $this->getImageValidationRules(),
         ]);