1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-08-09 10:22:51 +03:00

Worked towards phpstan level 2, 13 errors remain

This commit is contained in:
Dan Brown
2022-10-24 12:12:48 +01:00
parent 45d0860448
commit 2a65331573
9 changed files with 31 additions and 27 deletions

View File

@@ -181,7 +181,7 @@ class BookContents
$model->changeBook($newBook->id);
}
if ($chapterChanged) {
if ($model instanceof Page && $chapterChanged) {
$model->chapter_id = $newChapter->id ?? 0;
}
@@ -235,7 +235,7 @@ class BookContents
}
$hasPageEditPermission = userCan('page-update', $model);
$newParentInRightLocation = ($newParent instanceof Book || $newParent->book_id === $newBook->id);
$newParentInRightLocation = ($newParent instanceof Book || ($newParent instanceof Chapter && $newParent->book_id === $newBook->id));
$newParentPermission = ($newParent instanceof Chapter) ? 'chapter-update' : 'book-update';
$hasNewParentPermission = userCan($newParentPermission, $newParent);