Applied latest styleCI changes

This commit is contained in:
Dan Brown 2022-01-06 12:18:11 +00:00
parent cb0d674a71
commit 1a26b47782
No known key found for this signature in database
GPG Key ID: 46D9F943C24A2EF9
10 changed files with 55 additions and 51 deletions

View File

@ -119,9 +119,10 @@ class BookContents
// Sort our changes from our map to be chapters first
// Since they need to be process to ensure book alignment for child page changes.
$sortMapItems = $sortMap->all();
usort($sortMapItems, function(BookSortMapItem $itemA, BookSortMapItem $itemB) {
usort($sortMapItems, function (BookSortMapItem $itemA, BookSortMapItem $itemB) {
$aScore = $itemA->type === 'page' ? 2 : 1;
$bScore = $itemB->type === 'page' ? 2 : 1;
return $aScore - $bScore;
});
@ -265,6 +266,7 @@ class BookContents
/**
* Load models from the database into the given sort map.
*
* @return array<string, Entity>
*/
protected function loadModelsFromSortMap(BookSortMap $sortMap): array

View File

@ -41,5 +41,4 @@ class BookSortMap
return $map;
}
}

View File

@ -4,7 +4,6 @@ namespace BookStack\Entities\Tools;
class BookSortMapItem
{
/**
* @var int
*/
@ -30,7 +29,6 @@ class BookSortMapItem
*/
public $parentBookId;
public function __construct(int $id, int $sort, ?int $parentChapterId, string $type, int $parentBookId)
{
$this->id = $id;
@ -39,6 +37,4 @@ class BookSortMapItem
$this->type = $type;
$this->parentBookId = $parentBookId;
}
}

View File

@ -30,6 +30,7 @@ class RoleController extends Controller
$roles = $this->permissionsRepo->getAllRoles();
$this->setPageTitle(trans('settings.roles'));
return view('settings.roles.index', ['roles' => $roles]);
}
@ -51,6 +52,7 @@ class RoleController extends Controller
}
$this->setPageTitle(trans('settings.role_create'));
return view('settings.roles.create', ['role' => $role]);
}
@ -85,6 +87,7 @@ class RoleController extends Controller
}
$this->setPageTitle(trans('settings.role_edit'));
return view('settings.roles.edit', ['role' => $role]);
}
@ -120,6 +123,7 @@ class RoleController extends Controller
$roles->prepend($blankRole);
$this->setPageTitle(trans('settings.role_delete'));
return view('settings.roles.delete', ['role' => $role, 'roles' => $roles]);
}

View File

@ -36,6 +36,7 @@ class WebhookController extends Controller
public function create()
{
$this->setPageTitle(trans('settings.webhooks_create'));
return view('settings.webhooks.create');
}

View File

@ -3,7 +3,6 @@
namespace BookStack\Uploads;
use BookStack\Exceptions\ImageUploadException;
use BookStack\Util\WebSafeMimeSniffer;
use ErrorException;
use Exception;
use Illuminate\Contracts\Cache\Repository as Cache;
@ -240,6 +239,7 @@ class ImageService
}
$initialHeader = substr($imageData, 0, strpos($imageData, 'IDAT'));
return strpos($initialHeader, 'acTL') !== false;
}
@ -274,6 +274,7 @@ class ImageService
$storage = $this->getStorageDisk($image->type);
if ($storage->exists($this->adjustPathForStorageDisk($thumbFilePath, $image->type))) {
$this->cache->put($thumbCacheKey, $thumbFilePath, 60 * 60 * 72);
return $this->getPublicUrl($thumbFilePath);
}
@ -282,6 +283,7 @@ class ImageService
// Do not resize apng images where we're not cropping
if ($keepRatio && $this->isApngData($image, $imageData)) {
$this->cache->put($thumbCacheKey, $image->path, 60 * 60 * 72);
return $this->getPublicUrl($image->path);
}

View File

@ -84,7 +84,7 @@ class WebhookManagementTest extends TestCase
'endpoint' => 'https://example.com/updated-webhook',
'events' => [ActivityType::PAGE_CREATE, ActivityType::PAGE_UPDATE],
'active' => 'true',
'timeout' => 5
'timeout' => 5,
]);
$resp->assertRedirect('/settings/webhooks');

View File

@ -431,7 +431,6 @@ class SortTest extends TestCase
]);
}
public function test_book_sort_item_returns_book_content()
{
$books = Book::all();

View File

@ -170,6 +170,7 @@ class ThemeTest extends TestCase
$args = [];
$callback = function (...$eventArgs) use (&$args) {
$args = $eventArgs;
return ['test' => 'hello!'];
};
Theme::listen(ThemeEvents::WEBHOOK_CALL_BEFORE, $callback);