From fc109f7e1c43736edcf6e1546183416f87565310 Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Mon, 20 Dec 2021 17:40:27 +0000 Subject: [PATCH] Applied latest StyleCI changes --- app/Entities/Tools/Cloner.php | 5 +---- app/Http/Controllers/ChapterController.php | 3 ++- app/Http/Controllers/PageController.php | 1 + tests/Entity/ChapterTest.php | 4 ++-- tests/Permissions/RolesTest.php | 2 +- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/app/Entities/Tools/Cloner.php b/app/Entities/Tools/Cloner.php index 59d8077a4..b4923b90a 100644 --- a/app/Entities/Tools/Cloner.php +++ b/app/Entities/Tools/Cloner.php @@ -16,7 +16,6 @@ use Illuminate\Http\UploadedFile; class Cloner { - /** * @var PageRepo */ @@ -96,7 +95,6 @@ class Cloner $directChildren = $original->getDirectChildren(); foreach ($directChildren as $child) { - if ($child instanceof Chapter && userCan('chapter-create', $copyBook)) { $this->cloneChapter($child, $copyBook, $child->name); } @@ -146,5 +144,4 @@ class Cloner return $tags; } - -} \ No newline at end of file +} diff --git a/app/Http/Controllers/ChapterController.php b/app/Http/Controllers/ChapterController.php index 16f0779ca..7541ad0db 100644 --- a/app/Http/Controllers/ChapterController.php +++ b/app/Http/Controllers/ChapterController.php @@ -204,7 +204,7 @@ class ChapterController extends Controller session()->flashInput(['name' => $chapter->name]); return view('chapters.copy', [ - 'book' => $chapter->book, + 'book' => $chapter->book, 'chapter' => $chapter, ]); } @@ -225,6 +225,7 @@ class ChapterController extends Controller if (is_null($newParentBook)) { $this->showErrorNotification(trans('errors.selected_book_not_found')); + return redirect()->back(); } diff --git a/app/Http/Controllers/PageController.php b/app/Http/Controllers/PageController.php index 4a01dcc62..84187f745 100644 --- a/app/Http/Controllers/PageController.php +++ b/app/Http/Controllers/PageController.php @@ -458,6 +458,7 @@ class PageController extends Controller if (is_null($newParent)) { $this->showErrorNotification(trans('errors.selected_book_chapter_not_found')); + return redirect()->back(); } diff --git a/tests/Entity/ChapterTest.php b/tests/Entity/ChapterTest.php index 1d28ec839..f099ca2bb 100644 --- a/tests/Entity/ChapterTest.php +++ b/tests/Entity/ChapterTest.php @@ -74,7 +74,7 @@ class ChapterTest extends TestCase $resp->assertOk(); $resp->assertSee('Copy Chapter'); $resp->assertElementExists("input[name=\"name\"][value=\"{$chapter->name}\"]"); - $resp->assertElementExists("input[name=\"entity_selection\"]"); + $resp->assertElementExists('input[name="entity_selection"]'); } public function test_copy() @@ -85,7 +85,7 @@ class ChapterTest extends TestCase $otherBook = Book::query()->where('id', '!=', $chapter->book_id)->first(); $resp = $this->asEditor()->post($chapter->getUrl('/copy'), [ - 'name' => 'My copied chapter', + 'name' => 'My copied chapter', 'entity_selection' => 'book:' . $otherBook->id, ]); diff --git a/tests/Permissions/RolesTest.php b/tests/Permissions/RolesTest.php index 9368c7163..f69b5603c 100644 --- a/tests/Permissions/RolesTest.php +++ b/tests/Permissions/RolesTest.php @@ -177,7 +177,7 @@ class RolesTest extends TestCase $role = Role::query()->first(); $resp = $this->asAdmin()->get("/settings/roles/new?copy_from={$role->id}"); $resp->assertOk(); - $resp->assertElementExists('input[name="display_name"][value="' . ($role->display_name . ' (Copy)') . '"]'); + $resp->assertElementExists('input[name="display_name"][value="' . ($role->display_name . ' (Copy)') . '"]'); } public function test_manage_user_permission()