mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-10-30 07:32:39 +01:00
Applied styleci changes for conversion work
This commit is contained in:
parent
85f59b5275
commit
ba25dda031
@ -6,12 +6,10 @@ use BookStack\Actions\ActivityType;
|
||||
use BookStack\Entities\Models\Book;
|
||||
use BookStack\Entities\Models\Bookshelf;
|
||||
use BookStack\Entities\Tools\TrashCan;
|
||||
use BookStack\Exceptions\ImageUploadException;
|
||||
use BookStack\Exceptions\NotFoundException;
|
||||
use BookStack\Facades\Activity;
|
||||
use Exception;
|
||||
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
class BookshelfRepo
|
||||
|
@ -89,6 +89,7 @@ class Cloner
|
||||
|
||||
/**
|
||||
* Convert an entity to a raw data array of input data.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function entityToInputData(Entity $entity): array
|
||||
|
@ -45,6 +45,7 @@ class HierarchyTransformer
|
||||
$this->trashCan->destroyEntity($chapter);
|
||||
|
||||
Activity::add(ActivityType::BOOK_CREATE_FROM_CHAPTER, $book);
|
||||
|
||||
return $book;
|
||||
}
|
||||
|
||||
@ -80,6 +81,7 @@ class HierarchyTransformer
|
||||
$shelf->books()->sync($shelfBookSyncData);
|
||||
|
||||
Activity::add(ActivityType::BOOKSHELF_CREATE_FROM_BOOK, $shelf);
|
||||
|
||||
return $shelf;
|
||||
}
|
||||
}
|
@ -89,7 +89,8 @@ class BookApiController extends ApiController
|
||||
return response('', 204);
|
||||
}
|
||||
|
||||
protected function rules(): array {
|
||||
protected function rules(): array
|
||||
{
|
||||
return [
|
||||
'create' => [
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
|
@ -167,7 +167,7 @@ class BookController extends Controller
|
||||
|
||||
if ($request->has('image_reset')) {
|
||||
$validated['image'] = null;
|
||||
} else if (array_key_exists('image', $validated) && is_null($validated['image'])) {
|
||||
} elseif (array_key_exists('image', $validated) && is_null($validated['image'])) {
|
||||
unset($validated['image']);
|
||||
}
|
||||
|
||||
|
@ -167,7 +167,7 @@ class BookshelfController extends Controller
|
||||
|
||||
if ($request->has('image_reset')) {
|
||||
$validated['image'] = null;
|
||||
} else if (array_key_exists('image', $validated) && is_null($validated['image'])) {
|
||||
} elseif (array_key_exists('image', $validated) && is_null($validated['image'])) {
|
||||
unset($validated['image']);
|
||||
}
|
||||
|
||||
|
@ -274,7 +274,6 @@ class ChapterController extends Controller
|
||||
return redirect($chapter->getUrl());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convert the chapter to a book.
|
||||
*/
|
||||
|
@ -139,7 +139,7 @@ class BooksApiTest extends TestCase
|
||||
|
||||
// Ensure further updates without image do not clear cover image
|
||||
$resp = $this->put($this->baseEndpoint . "/{$book->id}", [
|
||||
'name' => 'My updated book again'
|
||||
'name' => 'My updated book again',
|
||||
]);
|
||||
$book->refresh();
|
||||
|
||||
|
@ -167,7 +167,7 @@ class ShelvesApiTest extends TestCase
|
||||
|
||||
// Ensure further updates without image do not clear cover image
|
||||
$resp = $this->put($this->baseEndpoint . "/{$shelf->id}", [
|
||||
'name' => 'My updated shelf again'
|
||||
'name' => 'My updated shelf again',
|
||||
]);
|
||||
$shelf->refresh();
|
||||
|
||||
|
@ -12,7 +12,6 @@ use Tests\TestCase;
|
||||
|
||||
class ConvertTest extends TestCase
|
||||
{
|
||||
|
||||
public function test_chapter_edit_view_shows_convert_option()
|
||||
{
|
||||
/** @var Chapter $chapter */
|
||||
@ -143,5 +142,4 @@ class ConvertTest extends TestCase
|
||||
$this->assertNotPermissionError($resp);
|
||||
$resp->assertRedirect();
|
||||
}
|
||||
|
||||
}
|
@ -8,7 +8,6 @@ use BookStack\Entities\Models\Chapter;
|
||||
use BookStack\Entities\Models\Page;
|
||||
use BookStack\Entities\Repos\BaseRepo;
|
||||
use BookStack\Entities\Repos\BookRepo;
|
||||
use BookStack\Entities\Repos\BookshelfRepo;
|
||||
use Illuminate\Support\Str;
|
||||
use Tests\Uploads\UsesImages;
|
||||
|
||||
|
@ -201,7 +201,7 @@ trait SharedTestHelpers
|
||||
/** @var RolePermission $permission */
|
||||
$permission = RolePermission::query()->where('name', '=', $permissionName)->firstOrFail();
|
||||
|
||||
$roles = $user->roles()->whereHas('permissions', function($query) use ($permission) {
|
||||
$roles = $user->roles()->whereHas('permissions', function ($query) use ($permission) {
|
||||
$query->where('id', '=', $permission->id);
|
||||
})->get();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user