X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/0288320700668bae9d87bcc7c3e7d66aaa05f6aa..refs/pull/3503/head:/app/Http/Controllers/ChapterController.php diff --git a/app/Http/Controllers/ChapterController.php b/app/Http/Controllers/ChapterController.php index 16f0779ca..83b9bb692 100644 --- a/app/Http/Controllers/ChapterController.php +++ b/app/Http/Controllers/ChapterController.php @@ -11,6 +11,7 @@ use BookStack\Entities\Tools\NextPreviousContentLocator; use BookStack\Entities\Tools\PermissionsUpdater; use BookStack\Exceptions\MoveOperationException; use BookStack\Exceptions\NotFoundException; +use BookStack\Exceptions\PermissionsException; use Illuminate\Http\Request; use Illuminate\Validation\ValidationException; use Throwable; @@ -180,6 +181,8 @@ class ChapterController extends Controller try { $newBook = $this->chapterRepo->move($chapter, $entitySelection); + } catch (PermissionsException $exception) { + $this->showPermissionError(); } catch (MoveOperationException $exception) { $this->showErrorNotification(trans('errors.selected_book_not_found')); @@ -204,7 +207,7 @@ class ChapterController extends Controller session()->flashInput(['name' => $chapter->name]); return view('chapters.copy', [ - 'book' => $chapter->book, + 'book' => $chapter->book, 'chapter' => $chapter, ]); } @@ -225,6 +228,7 @@ class ChapterController extends Controller if (is_null($newParentBook)) { $this->showErrorNotification(trans('errors.selected_book_not_found')); + return redirect()->back(); }