mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-08-26 04:05:57 +00:00
Check if parent is a chapter. If so, move into Book and assing page to chapter.
This commit is contained in:
parent
d7557befe2
commit
4daeb9daa6
@ -306,6 +306,13 @@ class PageRepo
|
||||
throw new PermissionsException('User does not have permission to create a page within the new parent');
|
||||
}
|
||||
|
||||
if ($parent instanceof Chapter) {
|
||||
$parentChapter = $parent;
|
||||
$parent = $parent->book;
|
||||
$page->chapter_id = $parentChapter->id;
|
||||
$page->save();
|
||||
}
|
||||
|
||||
$page->changeBook($parent instanceof Book ? $parent->id : $parent->book->id);
|
||||
$page->rebuildPermissions();
|
||||
return $parent;
|
||||
|
Loading…
Reference in New Issue
Block a user